diff --git a/application/cache/index.html b/application/cache/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/cache/index.html @@ -0,0 +1,11 @@ + + +
+Directory access is forbidden.
+ + + diff --git a/application/config/autoload.php b/application/config/autoload.php new file mode 100755 index 00000000..7cdc9013 --- /dev/null +++ b/application/config/autoload.php @@ -0,0 +1,135 @@ + 'ua'); +*/ +$autoload['libraries'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Drivers +| ------------------------------------------------------------------- +| These classes are located in system/libraries/ or in your +| application/libraries/ directory, but are also placed inside their +| own subdirectory and they extend the CI_Driver_Library class. They +| offer multiple interchangeable driver options. +| +| Prototype: +| +| $autoload['drivers'] = array('cache'); +| +| You can also supply an alternative property name to be assigned in +| the controller: +| +| $autoload['drivers'] = array('cache' => 'cch'); +| +*/ +$autoload['drivers'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Helper Files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['helper'] = array('url', 'file'); +*/ +$autoload['helper'] = 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('first_model', 'second_model'); +| +| You can also supply an alternative model name to be assigned +| in the controller: +| +| $autoload['model'] = array('first_model' => 'first'); +*/ +$autoload['model'] = array(); diff --git a/application/config/config.php b/application/config/config.php new file mode 100755 index 00000000..5766ecc1 --- /dev/null +++ b/application/config/config.php @@ -0,0 +1,524 @@ +]+$/i +| +| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! +| +*/ +$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; + +/* +|-------------------------------------------------------------------------- +| Enable Query Strings +|-------------------------------------------------------------------------- +| +| By default CodeIgniter uses search-engine friendly segment based URLs: +| example.com/who/what/where/ +| +| You can optionally enable standard query string based URLs: +| example.com?who=me&what=something&where=here +| +| Options are: TRUE or FALSE (boolean) +| +| The other items let you set the query string 'words' that will +| invoke your controllers and its functions: +| example.com/index.php?c=controller&m=function +| +| Please note that some of the helpers won't work as expected when +| this feature is enabled, since CodeIgniter is designed primarily to +| use segment based URLs. +| +*/ +$config['enable_query_strings'] = FALSE; +$config['controller_trigger'] = 'c'; +$config['function_trigger'] = 'm'; +$config['directory_trigger'] = 'd'; + +/* +|-------------------------------------------------------------------------- +| Allow $_GET array +|-------------------------------------------------------------------------- +| +| By default CodeIgniter enables access to the $_GET array. If for some +| reason you would like to disable it, set 'allow_get_array' to FALSE. +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['allow_get_array'] = TRUE; + +/* +|-------------------------------------------------------------------------- +| Error Logging Threshold +|-------------------------------------------------------------------------- +| +| You can enable error logging by setting a threshold over zero. The +| threshold determines what gets logged. Threshold options are: +| +| 0 = Disables logging, Error logging TURNED OFF +| 1 = Error Messages (including PHP errors) +| 2 = Debug Messages +| 3 = Informational Messages +| 4 = All Messages +| +| You can also pass an array with threshold levels to show individual error types +| +| array(2) = Debug Messages, without Error Messages +| +| For a live site you'll usually only enable Errors (1) to be logged otherwise +| your log files will fill up very fast. +| +*/ +$config['log_threshold'] = 0; + +/* +|-------------------------------------------------------------------------- +| Error Logging Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/logs/ directory. Use a full server path with trailing slash. +| +*/ +$config['log_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Log File Extension +|-------------------------------------------------------------------------- +| +| The default filename extension for log files. The default 'php' allows for +| protecting the log files via basic scripting, when they are to be stored +| under a publicly accessible directory. +| +| Note: Leaving it blank will default to 'php'. +| +*/ +$config['log_file_extension'] = ''; + +/* +|-------------------------------------------------------------------------- +| Log File Permissions +|-------------------------------------------------------------------------- +| +| The file system permissions to be applied on newly created log files. +| +| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal +| integer notation (i.e. 0700, 0644, etc.) +*/ +$config['log_file_permissions'] = 0644; + +/* +|-------------------------------------------------------------------------- +| Date Format for Logs +|-------------------------------------------------------------------------- +| +| Each item that is logged has an associated date. You can use PHP date +| codes to set your own date formatting +| +*/ +$config['log_date_format'] = 'Y-m-d H:i:s'; + +/* +|-------------------------------------------------------------------------- +| Error Views Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/views/errors/ directory. Use a full server path with trailing slash. +| +*/ +$config['error_views_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Cache Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/cache/ directory. Use a full server path with trailing slash. +| +*/ +$config['cache_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Cache Include Query String +|-------------------------------------------------------------------------- +| +| Whether to take the URL query string into consideration when generating +| output cache files. Valid options are: +| +| FALSE = Disabled +| TRUE = Enabled, take all query parameters into account. +| Please be aware that this may result in numerous cache +| files generated for the same page over and over again. +| array('q') = Enabled, but only take into account the specified list +| of query parameters. +| +*/ +$config['cache_query_string'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Encryption Key +|-------------------------------------------------------------------------- +| +| If you use the Encryption class, you must set an encryption key. +| See the user guide for more info. +| +| https://codeigniter.com/user_guide/libraries/encryption.html +| +*/ +$config['encryption_key'] = ''; + +/* +|-------------------------------------------------------------------------- +| Session Variables +|-------------------------------------------------------------------------- +| +| 'sess_driver' +| +| The storage driver to use: files, database, redis, memcached +| +| 'sess_cookie_name' +| +| The session cookie name, must contain only [0-9a-z_-] characters +| +| 'sess_expiration' +| +| The number of SECONDS you want the session to last. +| Setting to 0 (zero) means expire when the browser is closed. +| +| 'sess_save_path' +| +| The location to save sessions to, driver dependent. +| +| For the 'files' driver, it's a path to a writable directory. +| WARNING: Only absolute paths are supported! +| +| For the 'database' driver, it's a table name. +| Please read up the manual for the format with other session drivers. +| +| IMPORTANT: You are REQUIRED to set a valid save path! +| +| 'sess_match_ip' +| +| Whether to match the user's IP address when reading the session data. +| +| WARNING: If you're using the database driver, don't forget to update +| your session table's PRIMARY KEY when changing this setting. +| +| 'sess_time_to_update' +| +| How many seconds between CI regenerating the session ID. +| +| 'sess_regenerate_destroy' +| +| Whether to destroy session data associated with the old session ID +| when auto-regenerating the session ID. When set to FALSE, the data +| will be later deleted by the garbage collector. +| +| Other session cookie settings are shared with the rest of the application, +| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. +| +*/ +$config['sess_driver'] = 'files'; +$config['sess_cookie_name'] = 'ci_session'; +$config['sess_expiration'] = 7200; +$config['sess_save_path'] = NULL; +$config['sess_match_ip'] = FALSE; +$config['sess_time_to_update'] = 300; +$config['sess_regenerate_destroy'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Cookie Related Variables +|-------------------------------------------------------------------------- +| +| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions +| 'cookie_domain' = Set to .your-domain.com for site-wide cookies +| 'cookie_path' = Typically will be a forward slash +| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists. +| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript) +| +| Note: These settings (with the exception of 'cookie_prefix' and +| 'cookie_httponly') will also affect sessions. +| +*/ +$config['cookie_prefix'] = ''; +$config['cookie_domain'] = ''; +$config['cookie_path'] = '/'; +$config['cookie_secure'] = FALSE; +$config['cookie_httponly'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Standardize newlines +|-------------------------------------------------------------------------- +| +| Determines whether to standardize newline characters in input data, +| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value. +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['standardize_newlines'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Global XSS Filtering +|-------------------------------------------------------------------------- +| +| Determines whether the XSS filter is always active when GET, POST or +| COOKIE data is encountered +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['global_xss_filtering'] = FALSE; // DEFAULT +// $config['global_xss_filtering'] = TRUE; + +/* +|-------------------------------------------------------------------------- +| Cross Site Request Forgery +|-------------------------------------------------------------------------- +| Enables a CSRF cookie token to be set. When set to TRUE, token will be +| checked on a submitted form. If you are accepting user data, it is strongly +| recommended CSRF protection be enabled. +| +| 'csrf_token_name' = The token name +| 'csrf_cookie_name' = The cookie name +| 'csrf_expire' = The number in seconds the token should expire. +| 'csrf_regenerate' = Regenerate token on every submission +| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks +*/ +$config['csrf_protection'] = FALSE; +$config['csrf_token_name'] = 'csrf_test_name'; +$config['csrf_cookie_name'] = 'csrf_cookie_name'; +$config['csrf_expire'] = 7200; +$config['csrf_regenerate'] = TRUE; +$config['csrf_exclude_uris'] = array(); + +/* +|-------------------------------------------------------------------------- +| Output Compression +|-------------------------------------------------------------------------- +| +| Enables Gzip output compression for faster page loads. When enabled, +| the output class will test whether your server supports Gzip. +| Even if it does, however, not all browsers support compression +| so enable only if you are reasonably sure your visitors can handle it. +| +| Only used if zlib.output_compression is turned off in your php.ini. +| Please do not use it together with httpd-level output compression. +| +| VERY IMPORTANT: If you are getting a blank page when compression is enabled it +| means you are prematurely outputting something to your browser. It could +| even be a line of whitespace at the end of one of your scripts. For +| compression to work, nothing can be sent before the output buffer is called +| by the output class. Do not 'echo' any values with compression enabled. +| +*/ +$config['compress_output'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Master Time Reference +|-------------------------------------------------------------------------- +| +| Options are 'local' or any PHP supported timezone. This preference tells +| the system whether to use your server's local time as the master 'now' +| reference, or convert it to the configured one timezone. See the 'date +| helper' page of the user guide for information regarding date handling. +| +*/ +$config['time_reference'] = 'local'; + +/* +|-------------------------------------------------------------------------- +| Rewrite PHP Short Tags +|-------------------------------------------------------------------------- +| +| If your PHP installation does not have short tag support enabled CI +| can rewrite the tags on-the-fly, enabling you to utilize that syntax +| in your view files. Options are TRUE or FALSE (boolean) +| +| Note: You need to have eval() enabled for this to work. +| +*/ +$config['rewrite_short_tags'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Reverse Proxy IPs +|-------------------------------------------------------------------------- +| +| If your server is behind a reverse proxy, you must whitelist the proxy +| IP addresses from which CodeIgniter should trust headers such as +| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify +| the visitor's IP address. +| +| You can use both an array or a comma-separated list of proxy addresses, +| as well as specifying whole subnets. Here are a few examples: +| +| Comma-separated: '10.0.1.200,192.168.5.0/24' +| Array: array('10.0.1.200', '192.168.5.0/24') +*/ +$config['proxy_ips'] = ''; diff --git a/application/config/constants.php b/application/config/constants.php new file mode 100755 index 00000000..18d3b4b7 --- /dev/null +++ b/application/config/constants.php @@ -0,0 +1,85 @@ +db->last_query() and profiling of DB queries. +| When you run a query, with this setting set to TRUE (default), +| CodeIgniter will store the SQL statement for debugging purposes. +| However, this may cause high memory usage, especially if you run +| a lot of SQL queries ... disable this to avoid that problem. +| +| The $active_group variable lets you choose which connection group to +| make active. By default there is only one group (the 'default' group). +| +| The $query_builder variables lets you determine whether or not to load +| the query builder class. +*/ +$active_group = 'default'; +$query_builder = TRUE; + +$db['default'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'mcupramita123321', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + +$db['onedev'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'mcupramita123321', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['clinicdev'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'mcupramita123321', + 'database' => 'one_clinic', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['antrione'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'mcupramita123321', + 'database' => 'antrione', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['onelog'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'mcupramita123321', + 'database' => 'one_log', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); diff --git a/application/config/database.php b/application/config/database.php new file mode 100755 index 00000000..45b43836 --- /dev/null +++ b/application/config/database.php @@ -0,0 +1,1992 @@ +db->last_query() and profiling of DB queries. +| When you run a query, with this setting set to TRUE (default), +| CodeIgniter will store the SQL statement for debugging purposes. +| However, this may cause high memory usage, especially if you run +| a lot of SQL queries ... disable this to avoid that problem. +| +| The $active_group variable lets you choose which connection group to +| make active. By default there is only one group (the 'default' group). +| +| The $query_builder variables lets you determine whether or not to load +| the query builder class. +*/ +$active_group = 'default'; +$query_builder = TRUE; + +$db['default'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_lab', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + +$db['onedev'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_lab', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['one_lab_log'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_lab_log', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['klinik'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_klinik', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['antrione'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'antrione', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['onelog'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_log', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['mcutemp'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'temp_mcu', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['riau'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.201', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['pajajaran'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.202', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['toha'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.203', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['cimahi'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.204', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['ngagel'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.241', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['aditya'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.242', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['jemur'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.243', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['mulyo'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.244', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['parkus'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.245', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['hrm'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.246', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['cikditiro'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.191', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['sultan_agung'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.192', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['matraman'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.181', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['bonjer'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.182', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['samanhudi'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.183', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['ragunan'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.184', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['cirebon'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.216', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['veteran'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.171', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['dahlan'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.172', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['plaju'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.173', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['diponegoro'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.161', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['yamin'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.162', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['padang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.151', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['tegal'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.211', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['manado'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.221', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['pontianak'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.231', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['sudirman'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.156', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['magelang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.141', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['salatiga'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.146', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['semarang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.131', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['balikpapan'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.236', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['madiun'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.121', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['makasar'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.126', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['denpasar'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.136', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['tasik'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.176', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['dupang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.251', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['wonokusumo'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.252', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['tangkuban_perahu'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.81', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['ciliwung'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.82', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['kediri'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.85', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + + +$db['jember'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.88', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['simokerto'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.253', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['hertasning'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.127', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['tulungagung'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.91', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['hasyim'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.163', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + +$db['sumarecon'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.158', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + $db['kompolmaksum'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.132', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + $db['mojokerto'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.248', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'one', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + + + +$db['reg_bandung'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.206', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'bandung', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_tegal'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.212', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'tegal', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_manado'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.222', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'manado', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_pontianak'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.230', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'pontianak', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_surabaya'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.240', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'surabaya', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_yogya'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.195', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'yogya', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_jakarta'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.180', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'jakarta', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_cirebon'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.215', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'cirebon', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_palembang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.170', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'palembang', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_medan'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.160', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'medan', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_padang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.150', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'padang', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_pekanbaru'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.155', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'pekanbaru', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_magelang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.140', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'magelang', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_salatiga'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.148', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'salatiga', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_semarang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.130', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'semarang', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_balikpapan'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.235', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'balikpapan', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_madiun'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.120', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'madiun', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_makasar'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.125', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'makasar', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_denpasar'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.135', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'denpasar', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_tasik'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.175', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'tasikmalaya', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_prospek'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.250', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'prospek', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_sima_malang'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.80', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'malang', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_sima_kediri'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.84', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'kediri', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_sima_jember'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.87', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'jember', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_tulungagung'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.90', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'jember', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['reg_bekasi'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.157', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'jember', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + $db['reg_mojokerto'] = array( + 'dsn' => '', + 'hostname' => '192.168.250.249', + 'username' => 'root', + 'password' => 'pramita102938', + 'database' => 'mojokerto', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + $db['klinik'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_klinik', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + +$db['inventory'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_inventory', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); +$db['inventory_log'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_inventory_log', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); +$db['bloodbank'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => 'sasone102938', + 'database' => 'one_bb', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => FALSE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE + ); + + + diff --git a/application/config/doctypes.php b/application/config/doctypes.php new file mode 100755 index 00000000..59a7991e --- /dev/null +++ b/application/config/doctypes.php @@ -0,0 +1,24 @@ + '', + 'xhtml1-strict' => '', + 'xhtml1-trans' => '', + 'xhtml1-frame' => '', + 'xhtml-basic11' => '', + 'html5' => '', + 'html4-strict' => '', + 'html4-trans' => '', + 'html4-frame' => '', + 'mathml1' => '', + 'mathml2' => '', + 'svg10' => '', + 'svg11' => '', + 'svg11-basic' => '', + 'svg11-tiny' => '', + 'xhtml-math-svg-xh' => '', + 'xhtml-math-svg-sh' => '', + 'xhtml-rdfa-1' => '', + 'xhtml-rdfa-2' => '' +); diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php new file mode 100755 index 00000000..995f4830 --- /dev/null +++ b/application/config/foreign_chars.php @@ -0,0 +1,103 @@ + 'ae', + '/ö|œ/' => 'oe', + '/ü/' => 'ue', + '/Ä/' => 'Ae', + '/Ü/' => 'Ue', + '/Ö/' => 'Oe', + '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A', + '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a', + '/Б/' => 'B', + '/б/' => 'b', + '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', + '/ç|ć|ĉ|ċ|č/' => 'c', + '/Д/' => 'D', + '/д/' => 'd', + '/Ð|Ď|Đ|Δ/' => 'Dj', + '/ð|ď|đ|δ/' => 'dj', + '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E', + '/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e', + '/Ф/' => 'F', + '/ф/' => 'f', + '/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G', + '/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g', + '/Ĥ|Ħ/' => 'H', + '/ĥ|ħ/' => 'h', + '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I', + '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i', + '/Ĵ/' => 'J', + '/ĵ/' => 'j', + '/Ķ|Κ|К/' => 'K', + '/ķ|κ|к/' => 'k', + '/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L', + '/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l', + '/М/' => 'M', + '/м/' => 'm', + '/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N', + '/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n', + '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O', + '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o', + '/П/' => 'P', + '/п/' => 'p', + '/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R', + '/ŕ|ŗ|ř|ρ|р/' => 'r', + '/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S', + '/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's', + '/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T', + '/ț|ţ|ť|ŧ|т/' => 't', + '/Þ|þ/' => 'th', + '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U', + '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u', + '/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y', + '/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y', + '/В/' => 'V', + '/в/' => 'v', + '/Ŵ/' => 'W', + '/ŵ/' => 'w', + '/Ź|Ż|Ž|Ζ|З/' => 'Z', + '/ź|ż|ž|ζ|з/' => 'z', + '/Æ|Ǽ/' => 'AE', + '/ß/' => 'ss', + '/IJ/' => 'IJ', + '/ij/' => 'ij', + '/Œ/' => 'OE', + '/ƒ/' => 'f', + '/ξ/' => 'ks', + '/π/' => 'p', + '/β/' => 'v', + '/μ/' => 'm', + '/ψ/' => 'ps', + '/Ё/' => 'Yo', + '/ё/' => 'yo', + '/Є/' => 'Ye', + '/є/' => 'ye', + '/Ї/' => 'Yi', + '/Ж/' => 'Zh', + '/ж/' => 'zh', + '/Х/' => 'Kh', + '/х/' => 'kh', + '/Ц/' => 'Ts', + '/ц/' => 'ts', + '/Ч/' => 'Ch', + '/ч/' => 'ch', + '/Ш/' => 'Sh', + '/ш/' => 'sh', + '/Щ/' => 'Shch', + '/щ/' => 'shch', + '/Ъ|ъ|Ь|ь/' => '', + '/Ю/' => 'Yu', + '/ю/' => 'yu', + '/Я/' => 'Ya', + '/я/' => 'ya' +); diff --git a/application/config/hooks.php b/application/config/hooks.php new file mode 100755 index 00000000..a8f38a5d --- /dev/null +++ b/application/config/hooks.php @@ -0,0 +1,13 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/config/memcached.php b/application/config/memcached.php new file mode 100755 index 00000000..5c23b39c --- /dev/null +++ b/application/config/memcached.php @@ -0,0 +1,19 @@ + array( + 'hostname' => '127.0.0.1', + 'port' => '11211', + 'weight' => '1', + ), +); diff --git a/application/config/migration.php b/application/config/migration.php new file mode 100755 index 00000000..4b585a65 --- /dev/null +++ b/application/config/migration.php @@ -0,0 +1,84 @@ +migration->current() this is the version that schema will +| be upgraded / downgraded to. +| +*/ +$config['migration_version'] = 0; + +/* +|-------------------------------------------------------------------------- +| Migrations Path +|-------------------------------------------------------------------------- +| +| Path to your migrations folder. +| Typically, it will be within your application path. +| Also, writing permission is required within the migrations path. +| +*/ +$config['migration_path'] = APPPATH.'migrations/'; diff --git a/application/config/mimes.php b/application/config/mimes.php new file mode 100755 index 00000000..0ec9db0a --- /dev/null +++ b/application/config/mimes.php @@ -0,0 +1,184 @@ + array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), + 'cpt' => 'application/mac-compactpro', + 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'), + 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'), + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => array('application/octet-stream', 'application/x-msdownload'), + 'class' => 'application/octet-stream', + 'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'), + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'), + 'ai' => array('application/pdf', 'application/postscript'), + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'), + 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'), + 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'), + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'), + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => array('application/x-javascript', 'text/plain'), + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'), + 'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'), + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), + 'aif' => array('audio/x-aiff', 'audio/aiff'), + 'aiff' => array('audio/x-aiff', 'audio/aiff'), + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'), + 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'), + 'gif' => 'image/gif', + 'jpeg' => array('image/jpeg', 'image/pjpeg'), + 'jpg' => array('image/jpeg', 'image/pjpeg'), + 'jpe' => array('image/jpeg', 'image/pjpeg'), + 'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'png' => array('image/png', 'image/x-png'), + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => array('text/css', 'text/plain'), + 'html' => array('text/html', 'text/plain'), + 'htm' => array('text/html', 'text/plain'), + 'shtml' => array('text/html', 'text/plain'), + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => array('text/plain', 'text/x-log'), + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => array('application/xml', 'text/xml', 'text/plain'), + 'xsl' => array('application/xml', 'text/xsl', 'text/xml'), + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'), + 'movie' => 'video/x-sgi-movie', + 'doc' => array('application/msword', 'application/vnd.ms-office'), + 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'), + 'dot' => array('application/msword', 'application/vnd.ms-office'), + 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'), + 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'), + 'word' => array('application/msword', 'application/octet-stream'), + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => array('application/json', 'text/json'), + 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'), + 'p10' => array('application/x-pkcs10', 'application/pkcs10'), + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), + 'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'), + 'crl' => array('application/pkix-crl', 'application/pkcs-crl'), + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'), + '3g2' => 'video/3gpp2', + '3gp' => array('video/3gp', 'video/3gpp'), + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => array('video/mp4', 'video/x-f4v'), + 'flv' => 'video/x-flv', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'), + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'), + 'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'), + 'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'), + 'ics' => 'text/calendar', + 'ical' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'), + '7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'), + 'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'), + 'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'), + 'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'), + 'svg' => array('image/svg+xml', 'application/xml', 'text/xml'), + 'vcf' => 'text/x-vcard', + 'srt' => array('text/srt', 'text/plain'), + 'vtt' => array('text/vtt', 'text/plain'), + 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'), + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'otf' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web' +); diff --git a/application/config/mongo_db.php b/application/config/mongo_db.php new file mode 100644 index 00000000..b94e37d9 --- /dev/null +++ b/application/config/mongo_db.php @@ -0,0 +1,14 @@ +$config['mongo_db']['active'] = 'default'; +$config['mongo_db']['default']['no_auth'] = false; +$config['mongo_db']['default']['hostname'] = 'localhost'; +$config['mongo_db']['default']['port'] = '27017'; +$config['mongo_db']['default']['username'] = 'one'; +$config['mongo_db']['default']['password'] = 'sasone102938'; +$config['mongo_db']['default']['database'] = ''; +$config['mongo_db']['default']['db_debug'] = TRUE; +$config['mongo_db']['default']['return_as'] = 'array'; +$config['mongo_db']['default']['write_concerns'] = (int)1; +$config['mongo_db']['default']['journal'] = TRUE; +$config['mongo_db']['default']['read_preference'] = 'primary'; +$config['mongo_db']['default']['read_concern'] = 'local'; //'local', 'majority' or 'linearizable' +$config['mongo_db']['default']['legacy_support'] = TRUE; diff --git a/application/config/profiler.php b/application/config/profiler.php new file mode 100755 index 00000000..3db22e39 --- /dev/null +++ b/application/config/profiler.php @@ -0,0 +1,14 @@ + my_controller/index +| my-controller/my-method -> my_controller/my_method +*/ +$route['default_controller'] = 'welcome'; +$route['404_override'] = ''; +$route['translate_uri_dashes'] = FALSE; diff --git a/application/config/smileys.php b/application/config/smileys.php new file mode 100755 index 00000000..abf9a898 --- /dev/null +++ b/application/config/smileys.php @@ -0,0 +1,64 @@ + array('grin.gif', '19', '19', 'grin'), + ':lol:' => array('lol.gif', '19', '19', 'LOL'), + ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), + ':)' => array('smile.gif', '19', '19', 'smile'), + ';-)' => array('wink.gif', '19', '19', 'wink'), + ';)' => array('wink.gif', '19', '19', 'wink'), + ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), + ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), + ':-S' => array('confused.gif', '19', '19', 'confused'), + ':wow:' => array('surprise.gif', '19', '19', 'surprised'), + ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), + ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), + '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), + ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), + ':P' => array('raspberry.gif', '19', '19', 'raspberry'), + ':blank:' => array('blank.gif', '19', '19', 'blank stare'), + ':long:' => array('longface.gif', '19', '19', 'long face'), + ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), + ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), + ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), + '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), + ':down:' => array('downer.gif', '19', '19', 'downer'), + ':red:' => array('embarrassed.gif', '19', '19', 'red face'), + ':sick:' => array('sick.gif', '19', '19', 'sick'), + ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), + ':-/' => array('hmm.gif', '19', '19', 'hmmm'), + '>:(' => array('mad.gif', '19', '19', 'mad'), + ':mad:' => array('mad.gif', '19', '19', 'mad'), + '>:-(' => array('angry.gif', '19', '19', 'angry'), + ':angry:' => array('angry.gif', '19', '19', 'angry'), + ':zip:' => array('zip.gif', '19', '19', 'zipper'), + ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), + ':ahhh:' => array('shock.gif', '19', '19', 'shock'), + ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), + ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), + ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), + ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), + ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), + ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), + ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), + ':snake:' => array('snake.gif', '19', '19', 'snake'), + ':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'), + ':question:' => array('question.gif', '19', '19', 'question') + +); diff --git a/application/config/user_agents.php b/application/config/user_agents.php new file mode 100755 index 00000000..b6c85631 --- /dev/null +++ b/application/config/user_agents.php @@ -0,0 +1,214 @@ + 'Windows 10', + 'windows nt 6.3' => 'Windows 8.1', + 'windows nt 6.2' => 'Windows 8', + 'windows nt 6.1' => 'Windows 7', + 'windows nt 6.0' => 'Windows Vista', + 'windows nt 5.2' => 'Windows 2003', + 'windows nt 5.1' => 'Windows XP', + 'windows nt 5.0' => 'Windows 2000', + 'windows nt 4.0' => 'Windows NT 4.0', + 'winnt4.0' => 'Windows NT 4.0', + 'winnt 4.0' => 'Windows NT', + 'winnt' => 'Windows NT', + 'windows 98' => 'Windows 98', + 'win98' => 'Windows 98', + 'windows 95' => 'Windows 95', + 'win95' => 'Windows 95', + 'windows phone' => 'Windows Phone', + 'windows' => 'Unknown Windows OS', + 'android' => 'Android', + 'blackberry' => 'BlackBerry', + 'iphone' => 'iOS', + 'ipad' => 'iOS', + 'ipod' => 'iOS', + 'os x' => 'Mac OS X', + 'ppc mac' => 'Power PC Mac', + 'freebsd' => 'FreeBSD', + 'ppc' => 'Macintosh', + 'linux' => 'Linux', + 'debian' => 'Debian', + 'sunos' => 'Sun Solaris', + 'beos' => 'BeOS', + 'apachebench' => 'ApacheBench', + 'aix' => 'AIX', + 'irix' => 'Irix', + 'osf' => 'DEC OSF', + 'hp-ux' => 'HP-UX', + 'netbsd' => 'NetBSD', + 'bsdi' => 'BSDi', + 'openbsd' => 'OpenBSD', + 'gnu' => 'GNU/Linux', + 'unix' => 'Unknown Unix OS', + 'symbian' => 'Symbian OS' +); + + +// The order of this array should NOT be changed. Many browsers return +// multiple browser types so we want to identify the sub-type first. +$browsers = array( + 'OPR' => 'Opera', + 'Flock' => 'Flock', + 'Edge' => 'Edge', + 'Chrome' => 'Chrome', + // Opera 10+ always reports Opera/9.80 and appends Version/Directory access is forbidden.
+ + + diff --git a/application/helpers/index.html b/application/helpers/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/helpers/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/helpers/uuid_helper.php b/application/helpers/uuid_helper.php new file mode 100644 index 00000000..1828d216 --- /dev/null +++ b/application/helpers/uuid_helper.php @@ -0,0 +1,24 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/index.html b/application/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/language/english/index.html b/application/language/english/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/language/english/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/language/index.html b/application/language/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/language/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/libraries/Ai_whisper.php b/application/libraries/Ai_whisper.php new file mode 100644 index 00000000..e0425973 --- /dev/null +++ b/application/libraries/Ai_whisper.php @@ -0,0 +1,197 @@ + "ERR", "message" => "Error: File not found."]; + } + + // Get file extension and appropriate MIME type + $extension = strtolower(pathinfo($audioPath, PATHINFO_EXTENSION)); + $mimeType = $this->getMimeType($extension); + + // Create CURLFile with correct MIME type + $curlFile = new CURLFile( + $audioPath, // File path + $mimeType, // MIME type + basename($audioPath) // Filename + ); + + // Prepare the multipart form data + $postFields = [ + 'file' => $curlFile, + 'model' => $this->whisperModelName, + 'response_format' => 'verbose_json', + 'timestamp_granularities' => ['segment'], + 'language' => $this->whisperLanguage, + ]; + + // Initialize cURL session + $ch = curl_init(); + + // Set cURL options + curl_setopt_array($ch, [ + CURLOPT_URL => self::API_URL, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $postFields, + CURLOPT_HTTPHEADER => [ + 'Authorization: Bearer ' . self::API_KEY, + // Don't set Content-Type header - cURL will set it automatically with boundary + ], + CURLOPT_TIMEOUT => 300, // 5 minutes timeout for large files + CURLOPT_SSL_VERIFYPEER => true, + ]); + + // Execute request + $response = curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + $error = curl_error($ch); + + curl_close($ch); + + // Handle cURL errors + if ($error) { + return ["status" => "ERR", "message" => "cURL Error: " . json_encode($error, true)]; + } + + // Handle API errors + if ($httpCode !== 200) { + $errorData = json_decode($response, true); + return ["status" => "ERR", "message" => "API Error: " . ($errorData['error'] ?? "Unknown error occurred")]; + } + + // Decode and return the response + $result = json_decode($response, true); + return [ + 'status' => 'OK', + 'data' => $this->processDiarization($result, $persons), + ]; + } + + private function getMimeType($extension) + { + $mimeTypes = [ + 'mp3' => 'audio/mpeg', + 'wav' => 'audio/wav', + 'm4a' => 'audio/mp4', + 'ogg' => 'audio/ogg' + ]; + + return isset($mimeTypes[$extension]) ? $mimeTypes[$extension] : 'audio/mpeg'; + } + + // * INFO: Sementara begini dulu sampai bisa diarize pakai python + private function processDiarization($response, $persons) + { + $result = [ + 'diarized' => [], + 'raw' => $response + ]; + + // Create array of speaker IDs based on number of persons + $speakers = []; + for ($i = 1; $i <= $persons; $i++) { + $speakers[] = sprintf("SPEAKER_%02d", $i); + } + + // Track current speaker index + $currentSpeakerIndex = 0; + $speakerCount = count($speakers); + + foreach ($response['segments'] as $segment) { + // * 20250224: Maybe digunakan sometime + // $diarizedSegment = [ + // 'who' => $speakers[$currentSpeakerIndex], + // 'start' => $segment['start'], + // 'end' => $segment['end'], + // 'text' => trim($segment['text']) + // ]; + + $convo = $speakers[$currentSpeakerIndex] . ": " . trim($segment['text']); + + $result['diarized'][] = $convo; + // $result['raw'][] = $diarizedSegment; + + $currentSpeakerIndex = ($currentSpeakerIndex + 1) % $speakerCount; + } + + return $result; + } + + private function langChainDiarization($response) + { + $prompt = "This is a Whisper transcript of a 2-person conversation using Bahasa Indonesia. " . + "Identify speakers and segment the dialogue based on context because segmentation from whisper is sometimes wrong. " . + "Return the result in JSON format:\n" . + "{\n" . + "\"text\": \"Full transcription text...\",\n" . + "\"diarized\": [\n" . + "{\n" . + "\"who\": \"Speaker 1 or Speaker 2\",\n" . + "\"start\": timestamp,\n" . + "\"end\": timestamp,\n" . + "\"text\": \"...\"\n" . + "}\n" . + "]\n" . + "}\n" . + "Ensure accurate segmentation and speaker attribution.\n" . + "The convo:\n\n" . + $response['text']; + + $payload = json_encode([ + "model" => $this->diarizeModelName, + "messages" => [ + [ + "role" => "system", + "content" => "You are a helpful assistant that analyzes conversations and identifies speakers." + ], + [ + "role" => "user", + "content" => $prompt, + ] + ], + "options" => ["temperature" => $this->temperatureDiarize], + "stream" => false + ]); + + // Initialize cURL + $ch = curl_init(self::API_URL); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + "Content-Type: application/json", + "Authorization: Bearer " . self::API_KEY + ]); + curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); + + // Execute request + $response = curl_exec($ch); + if (curl_errno($ch)) { + $error = curl_error($ch); + curl_close($ch); + return ["status" => "ERR", "message" => curl_error($ch)]; + } + curl_close($ch); + + $response = strip_tags($response); + $responseData = json_decode($response, true); + $content = $responseData['choices'][0]['message']['content']; + + if (is_null($responseData) || !isset($content)) { + return ["status" => "ERR", "message" => "raw : $response"]; + } + } +} diff --git a/application/libraries/Autosamplingverif.php b/application/libraries/Autosamplingverif.php new file mode 100644 index 00000000..326e7620 --- /dev/null +++ b/application/libraries/Autosamplingverif.php @@ -0,0 +1,230 @@ +db_onedev = $CI->load->database("default", true); + } + + function clean_mysqli_connection( $dbc ) +{ + while( mysqli_more_results($dbc) ) + { + if(mysqli_next_result($dbc)) + { + $result = mysqli_use_result($dbc); + + if( get_class($result) == 'mysqli_stmt' ) + { + mysqli_stmt_free_result($result); + } + else + { + unset($result); + } + } + } +} + + function doaction($rst_id,$samplingtime,$userid){ + $sql = "call sp_fo_barcode_generate_again_not_exist(" . $rst_id . ")"; + $this->db_onedev->query($sql); + $this->clean_mysqli_connection($this->db_onedev->conn_id); + + $sql = "SELECT * + FROM t_orderheader + JOIN t_orderheaderaddon ON T_OrderHeaderAddOnT_OrderHeaderID = T_OrderHeaderID + WHERE T_OrderHeaderID = {$rst_id}"; + //echo $sql; + $row_addon = $this->db_onedev->query($sql)->row_array(); + + $readytime = date('Y-m-d H:i:s', strtotime($samplingtime)); + //echo $readytime; + $sql = "UPDATE t_ordersample + SET + T_OrderSampleSampling = 'Y', + T_OrderSampleSamplingDate = DATE('{$samplingtime}'), + T_OrderSampleSamplingTime = TIME('{$samplingtime}'), + T_OrderSampleSamplingUserID = {$userid}, + T_OrderSampleReceive = 'Y', + T_OrderSampleReceiveDate = DATE('{$samplingtime}'), + T_OrderSampleReceiveTime = TIME('{$samplingtime}'), + T_OrderSampleReadyToProcessDateTime = '{$readytime}', + T_OrderSampleVerification = 'Y', + T_OrderSampleVerificationDate = CURDATE(), + T_OrderSampleVerificationTime = CURTIME(), + T_OrderSampleVerificationUserID = {$userid}, + T_OrderSampleSendHandling = 'Y', + T_OrderSampleSendHandlingDate = CURDATE(), + T_OrderSampleSendHandlingTime = CURTIME(), + T_OrderSampleSendHandlingUserID = {$userid}, + T_OrderSampleReceiveUserID = {$userid}, + T_OrderSampleReceiveHandling = 'Y', + T_OrderSampleReceiveHandlingDate = CURDATE(), + T_OrderSampleReceiveHandlingTime = CURTIME(), + T_OrderSampleReceiveHandlingUserID = {$userid} + WHERE + T_OrderSampleT_OrderHeaderID = {$rst_id}"; + $upd_ordersample = $this->db_onedev->query($sql); + //echo $sql; + $sql = "SELECT * + FROM t_ordersample + JOIN t_barcodelab ON T_OrderSampleT_BarcodeLabID = T_BarcodeLabID AND T_BarcodeLabIsActive = 'Y' + JOIN t_sampletype ON T_SampleTypeID = T_OrderSampleT_SampleTypeID + JOIN t_bahan ON T_SampleTypeT_BahanID = T_BahanID + JOIN t_samplestation ON T_BahanT_SampleStationID = T_SampleStationID + WHERE + T_OrderSampleT_OrderHeaderID = {$rst_id} AND + T_OrderSampleIsActive = 'Y'"; + $data_loop = $this->db_onedev->query($sql)->result_array(); + if ($data_loop) { + foreach ($data_loop as $ks => $vs) { + $sql = "INSERT INTO t_ordersamplereq( + T_OrderSampleReqT_OrderHeaderID, + T_OrderSampleReqT_SampleStationID, + T_OrderSampleReqT_OrderSampleID, + T_OrderSampleReqNat_PositionID, + T_OrderSampleReqStatus, + T_OrderSampleReqs, + T_OrderSampleReqUserID, + T_OrderSampleReqCreated + ) + VALUES( + {$rst_id}, + {$vs['T_SampleStationID']}, + {$vs['T_OrderSampleID']}, + '2', + 'Y', + '[]', + {$userid}, + NOW() + )ON DUPLICATE KEY UPDATE + T_OrderSampleReqStatus = 'Y', + T_OrderSampleReqs = '[]', + T_OrderSampleReqUserID = {$userid}"; + //echo $sql; + $this->db_onedev->query($sql); + + $sql = "INSERT INTO sample_by_step( + SampleByStepM_StatusSampleCode, + SampleByStepT_OrderHeaderID, + SampleByStepT_BarcodeLabID, + SampleByStepRequirementStatus, + SampleByStepRequirements, + SampleByStepUserID, + SampleByStepDateTime + ) + VALUES( + 'SAMPLING.Sampling.Sampled', + {$rst_id}, + {$vs['T_BarcodeLabID']}, + 'Y', + '[]', + {$userid}, + '{$row_addon['T_OrderHeaderAddOnOnlySampleTime']}' + )"; + $this->db_onedev->query($sql); + + $sql = "INSERT INTO sample_by_step( + SampleByStepM_StatusSampleCode, + SampleByStepT_OrderHeaderID, + SampleByStepT_BarcodeLabID, + SampleByStepRequirementStatus, + SampleByStepRequirements, + SampleByStepUserID, + SampleByStepDateTime + ) + VALUES( + 'SAMPLING.Sampling.Received', + {$rst_id}, + {$vs['T_BarcodeLabID']}, + 'Y', + '[]', + {$userid}, + '{$row_addon['T_OrderHeaderAddOnOnlySampleTime']}' + )"; + $this->db_onedev->query($sql); + + $sql = "INSERT INTO sample_by_step( + SampleByStepM_StatusSampleCode, + SampleByStepT_OrderHeaderID, + SampleByStepT_BarcodeLabID, + SampleByStepRequirementStatus, + SampleByStepRequirements, + SampleByStepUserID, + SampleByStepDateTime + ) + VALUES( + 'SAMPLING.Verification.Verify', + {$prm['sample']['T_OrderHeaderID']}, + {$prm['sample']['T_BarcodeLabID']}, + '{$prm['sample']['requirement_status']}', + '{$requirements}', + {$userid}, + NOW() + )"; + $this->db_onedev->query($sql); + + $sql = "INSERT INTO sample_by_step( + SampleByStepM_StatusSampleCode, + SampleByStepT_OrderHeaderID, + SampleByStepT_BarcodeLabID, + SampleByStepRequirementStatus, + SampleByStepRequirements, + SampleByStepUserID, + SampleByStepDateTime + ) + VALUES( + 'SAMPLING.Verification.To.Handling', + {$prm['sample']['T_OrderHeaderID']}, + {$prm['sample']['T_BarcodeLabID']}, + '{$prm['sample']['requirement_status']}', + '{$requirements}', + {$userid}, + NOW() + )"; + $this->db_onedev->query($sql); + + $sql = "INSERT INTO sample_by_step( + SampleByStepM_StatusSampleCode, + SampleByStepT_OrderHeaderID, + SampleByStepT_BarcodeLabID, + SampleByStepRequirementStatus, + SampleByStepRequirements, + SampleByStepUserID, + SampleByStepDateTime + ) + VALUES( + 'SAMPLING.Handling.From.Verification', + {$prm['sample']['T_OrderHeaderID']}, + {$prm['sample']['T_BarcodeLabID']}, + '{$prm['sample']['requirement_status']}', + '{$requirements}', + {$userid}, + NOW() + )"; + $this->db_onedev->query($sql); + + $query = " INSERT INTO t_sampling_queue_last_status ( + T_SamplingQueueLastStatusT_SampleStationID, + T_SamplingQueueLastStatusT_OrderHeaderID, + T_SamplingQueueLastStatusT_SamplingQueueStatusID, + T_SamplingQueueLastStatusUserID) + VALUES( + {$vs['T_SampleStationID']}, + {$rst_id}, + '5', + {$userid}) + ON DUPLICATE KEY UPDATE + T_SamplingQueueLastStatusT_SamplingQueueStatusID = 5, + T_SamplingQueueLastStatusUserID = {$userid}"; + //echo $query; + $this->db_onedev->query($query); + } + } + + } + +} diff --git a/application/libraries/Ciqrcode.php b/application/libraries/Ciqrcode.php new file mode 100644 index 00000000..da7cad7c --- /dev/null +++ b/application/libraries/Ciqrcode.php @@ -0,0 +1,106 @@ +initialize($config); + } + + public function initialize($config = array()) { + $this->cacheable = (isset($config['cacheable'])) ? $config['cacheable'] : $this->cacheable; + $this->cachedir = (isset($config['cachedir'])) ? $config['cachedir'] : FCPATH.$this->cachedir; + $this->errorlog = (isset($config['errorlog'])) ? $config['errorlog'] : FCPATH.$this->errorlog; + $this->quality = (isset($config['quality'])) ? $config['quality'] : $this->quality; + $this->size = (isset($config['size'])) ? $config['size'] : $this->size; + + // use cache - more disk reads but less CPU power, masks and format templates are stored there + if (!defined('QR_CACHEABLE')) define('QR_CACHEABLE', $this->cacheable); + + // used when QR_CACHEABLE === true + if (!defined('QR_CACHE_DIR')) define('QR_CACHE_DIR', $this->cachedir); + + // default error logs dir + if (!defined('QR_LOG_DIR')) define('QR_LOG_DIR', $this->errorlog); + + // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code + if ($this->quality) { + if (!defined('QR_FIND_BEST_MASK')) define('QR_FIND_BEST_MASK', true); + } else { + if (!defined('QR_FIND_BEST_MASK')) define('QR_FIND_BEST_MASK', false); + if (!defined('QR_DEFAULT_MASK')) define('QR_DEFAULT_MASK', $this->quality); + } + + // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly + if (!defined('QR_FIND_FROM_RANDOM')) define('QR_FIND_FROM_RANDOM', false); + + // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images + if (!defined('QR_PNG_MAXIMUM_SIZE')) define('QR_PNG_MAXIMUM_SIZE', $this->size); + } + + public function generate($params = array()) { + if (isset($params['black']) + && is_array($params['black']) + && count($params['black']) == 3 + && array_filter($params['black'], 'is_int') === $params['black']) { + QRimage::$black = $params['black']; + } + + if (isset($params['white']) + && is_array($params['white']) + && count($params['white']) == 3 + && array_filter($params['white'], 'is_int') === $params['white']) { + QRimage::$white = $params['white']; + } + + $params['data'] = (isset($params['data'])) ? $params['data'] : 'QR Code Library'; + if (isset($params['savename'])) { + $level = 'L'; + if (isset($params['level']) && in_array($params['level'], array('L','M','Q','H'))) $level = $params['level']; + + $size = 4; + if (isset($params['size'])) $size = min(max((int)$params['size'], 1), 10); + + QRcode::png($params['data'], $params['savename'], $level, $size, 2); + return $params['savename']; + } else { + $level = 'L'; + if (isset($params['level']) && in_array($params['level'], array('L','M','Q','H'))) $level = $params['level']; + + $size = 4; + if (isset($params['size'])) $size = min(max((int)$params['size'], 1), 10); + + QRcode::png($params['data'], NULL, $level, $size, 2); + } + } +} + +/* end of file */ diff --git a/application/libraries/Etlfisik.php b/application/libraries/Etlfisik.php new file mode 100644 index 00000000..b41a55b3 --- /dev/null +++ b/application/libraries/Etlfisik.php @@ -0,0 +1,3273 @@ +db_smartone = $CI->load->database("default", true); + $this->db_onedev = $CI->load->database("default", true); + } + + function clean_mysqli_connection($dbc) + { + while (mysqli_more_results($dbc)) { + if (mysqli_next_result($dbc)) { + $result = mysqli_use_result($dbc); + + if (get_class($result) == 'mysqli_stmt') { + mysqli_stmt_free_result($result); + } else { + unset($result); + } + } + } + } + + function generate_kelainan_by_order($orderID,$userID){ + $this->generate_kelainan_nonlab($orderID,$userID); + $this->generate_kelainan_lab($orderID,$userID); + //$this->generate_kelainan_lab($orderID,$userID); + $this->generate_all_fisik($orderID,$userID); + $sql = "SELECT * + FROM t_orderheader + JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryNonlab_TemplateID = 27 AND + So_ResultEntryIsActive = 'Y' + WHERE + T_OrderHeaderID = ? AND T_OrderHeaderIsActive = 'Y'"; + $query = $this->db_onedev->query($sql,array($orderID)); + $rst_fisik = $query->result_array(); + $soReID = 0; + if(count($rst_fisik)> 0){ + $soReID = $rst_fisik[0]['So_ResultEntryID']; + } + + $this->generate_summaries($orderID,$soReID,$userID,$debugID=0); + + $sql = " SELECT 'lab' as type, + T_KelainanLabID, + Mcu_KelainanName, + fn_get_translate_word_separator_comma(Mcu_KelainanName,2) as Mcu_KelainanNameEng, + Mcu_FitnessCategoryID, + Mcu_FitnessCategoryName, + Mcu_FitnessCategoryEng, + Mcu_FitnessCategoryLevel, + Nat_TestName + FROM t_kelainan_lab + JOIN mcu_summarylab ON T_KelainanLabMcu_SummaryLabID = Mcu_SummaryLabID + JOIN mcu_kelainan ON Mcu_summaryLabMcu_KelainanID = Mcu_KelainanID + JOIN mcu_fitness_category ON Mcu_SummaryLabMcu_FitnessCategoryID = Mcu_FitnessCategoryID + JOIN nat_test ON Mcu_SummaryLabNat_TestID = Nat_TestID + WHERE + T_KelainanLabT_OrderHeaderID = ? AND + T_KelainanLabIsActive= 'Y' + UNION + SELECT 'nonlab' as type, + T_KelainanNonLabID, + Mcu_KelainanName, + fn_get_translate_word_separator_comma(Mcu_KelainanName,2) as Mcu_KelainanNameEng, + Mcu_FitnessCategoryID, + Mcu_FitnessCategoryName, + Mcu_FitnessCategoryEng, + Mcu_FitnessCategoryLevel, + Nat_TestName + FROM t_kelainan_nonlab + JOIN mcu_summarynonlab ON T_KelainanNonLabMcu_SummaryNonlabID = Mcu_SummaryNonlabID + JOIN mcu_kelainan ON Mcu_SummaryNonlabMcu_KelainanID = Mcu_KelainanID + JOIN mcu_fitness_category ON Mcu_SummaryNonlabMcu_FitnessCategoryID = Mcu_FitnessCategoryID + JOIN nat_test ON Mcu_SummaryNonlabNat_TestID = Nat_TestID + WHERE + T_KelainanNonLabT_OrderHeaderID = ? AND + T_KelainanNonLabIsActive= 'Y' + UNION + SELECT 'fisik' as type, + T_KelainanFiskID, + Mcu_KelainanName, + fn_get_translate_word_separator_comma(Mcu_KelainanName,2) as Mcu_KelainanNameEng, + Mcu_FitnessCategoryID, + Mcu_FitnessCategoryName, + Mcu_FitnessCategoryEng, + Mcu_FitnessCategoryLevel, + GROUP_CONCAT(CONCAT(Mcu_FisikValueLabel,'|',Mcu_FisikValueSegment,'|',Mcu_FisikValueCategory)) as Nat_TestName + FROM t_kelainan_fisik + JOIN mcu_fisiksummary ON T_KelainanFiskMcu_FisikSummaryID = Mcu_FisikSummaryID + JOIN mcu_kelainan ON Mcu_FisikSummaryMcu_KelainanID = Mcu_KelainanID + JOIN mcu_fitness_category ON Mcu_FisikSummaryMcu_FitnessCategoryID = Mcu_FitnessCategoryID + JOIN mcu_fisiksummarydetail ON Mcu_FisikSummaryDetailMcu_FisikSummaryID = Mcu_FisikSummaryID AND + Mcu_FisikSummaryDetailIsActive = 'Y' + JOIN mcu_fisikvalue ON Mcu_FisikValueT_OrderHeaderID = T_KelainanFiskT_OrderHeaderID AND + Mcu_FisikSummaryDetailCode = Mcu_FisikValueCode AND Mcu_FisikValueIsActive = 'Y' + WHERE + T_KelainanFiskT_OrderHeaderID = ? AND + T_KelainanFiskIsActive = 'Y' + GROUP BY T_KelainanFiskID"; + $query = $this->db_onedev->query($sql,array($orderID,$orderID,$orderID)); + //echo $this->db_onedev->last_query(); + $rtn = $query->result_array(); + $status = array("id"=>"1","name" => "BAIK", "name_eng" => "FIT FOR WORK" ,"level" => "1"); + if(count($rtn) > 0){ + $max = 0; + foreach ($rtn as $key => $value) { + if(intval($value['Mcu_FitnessCategoryLevel']) > $max){ + $max = intval($value['Mcu_FitnessCategoryLevel']); + $status = array("id"=> $value['Mcu_FitnessCategoryID'],"name" => $value['Mcu_FitnessCategoryName'], "name_eng" => $value['Mcu_FitnessCategoryEng'] ,"level" => $value['Mcu_FitnessCategoryLevel']); + } + + } + } + + + $resposne = array("status" => $status,"data" => $rtn); + + return $resposne; + } + + function generate_kelainan_nonlab($orderID,$userID){ + $sql = "SELECT So_ResultEntryID, T_OrderHeaderID, T_TestNat_TestID, Mcu_SummaryNonlabID, Mcu_SummaryNonlabMcu_KelainanID, Mcu_SummaryNonlabID + FROM so_resultentry_category_result + JOIN so_resultentry ON So_ResultEntryCategoryResultSo_ResultEntryID = So_ResultEntryID AND + So_ResultEntryStatus <> 'NEW' AND So_ResultEntryIsActive = 'Y' + JOIN t_orderheader ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND T_OrderHeaderIsActive = 'Y' AND + T_OrderHeaderID = ? + JOIN t_orderdetail ON So_ResultEntryT_OrderDetailID = T_OrderDetailID AND T_OrderDetailIsActive = 'Y' + JOIN t_test ON T_OrderDetailT_TestID = T_TestID + JOIN mcu_summarynonlab ON Mcu_SummaryNonlabNat_TestID = T_TestNat_TestID AND + Mcu_SummaryNonlabIsActive = 'Y' AND So_ResultEntryCategoryNonlabConclusionDetailID IN (Mcu_SummaryNonlabConclusionDetailIDs) + WHERE + So_ResultEntryCategoryResultIsActive = 'Y'"; + + $qry = $this->db_onedev->query($sql,array($orderID)); + if (!$qry) { + echo $this->db_onedev->last_query(); + echo json_encode([ + "status" => "ERR", + "message" => "Error get order | " . $this->db_onedev->error()["message"] + ]); + exit; + } + + $rows = $qry->result_array(); + $sql = "UPDATE t_kelainan_nonlab SET + T_KelainanNonLabIsActive = 'N' + WHERE + T_KelainanNonLabT_OrderHeaderID = ? AND + T_KelainanNonLabIsActive = 'Y' + "; + $qry = $this->db_onedev->query($sql,array($orderID)); + + foreach ($rows as $key => $value) { + + + $sql = "INSERT INTO t_kelainan_nonlab ( + T_KelainanNonLabSo_ResultEntryID, + T_KelainanNonLabT_OrderHeaderID, + T_KelainanNonLabNat_TestID, + T_KelainanNonLabMcu_SummaryNonlabID, + T_KelainanNonLabCreatedUserID, + T_KelainanLabNonCreated + ) VALUES(?,?,?,?,?,NOW())"; + $qry = $this->db_onedev->query($sql,[ + $value['So_ResultEntryID'], + $value['T_OrderHeaderID'], + $value['T_TestNat_TestID'], + $value['Mcu_SummaryNonlabID'], + $userID + ]); + } + + } + + function generate_kelainan_lab($orderid) + { + $sql = "SELECT + T_OrderHeaderID,T_OrderHeaderLabNumber, + T_TestName, T_OrderDetailID, T_OrderDetailResult, T_OrderDetailNat_MethodeID, + T_OrderDetailNat_MethodeID, T_OrderDetailNat_MethodeName, + T_OrderDetailMinValue, T_OrderDetailMaxValue, T_OrderDetailMinValueInclusive, + T_OrderDetailMaxValueInclusive, + T_OrderDetailNormalValueNote, + Mcu_SummaryLabID, + Mcu_SummaryLabValue, + Mcu_SummaryLabNat_MethodeID, + Mcu_SummaryLabWithMethode, + Mcu_SummaryLabType, + Mcu_SummaryLabIsNormalValue, + Mcu_SummaryLabIsRange, + Mcu_SummaryLabMinInclusive, + Mcu_SummaryLabMinValue, + Mcu_SummaryLabMaxInclusive, + Mcu_SummaryLabMaxValue, + Mcu_KelainanID, Mcu_KelainanName, Mcu_KelainanClasification, + Nat_TestID, + Nat_TestCode, + mcu_kelainangroup.* + from t_orderdetail + join t_orderheader on T_OrderHeaderID = {$orderid} + and T_OrderHeaderID = T_OrderDetailT_OrderHeaderID + and T_OrderDetailIsActive = 'Y' + JOIN m_patient + ON T_OrderHeaderM_PatientID = M_PatientID + JOIN m_sex ON M_PatientM_SexID = M_SexID + join t_test + on T_OrderDetailT_TestID = T_TestID + join nat_test ON T_TestNat_TestID = Nat_TestID + join mcu_summarylab on T_TestNat_TestID = Mcu_SummaryLabNat_TestID AND Mcu_SummaryLabIsActive = 'Y' + AND (Mcu_SummaryLabGender = 'A' OR (Mcu_SummaryLabGender <> 'A' AND Mcu_SummaryLabGender = CASE + WHEN LOWER(M_SexNameLang) = 'male' THEN 'M' + WHEN LOWER(M_SexNameLang) = 'female' THEN 'F' + else '' + END)) + join mcu_kelainan on Mcu_SummaryLabMcu_KelainanID = Mcu_KelainanID + join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID"; + //echo $sql; + $qry = $this->db_onedev->query($sql); + if (!$qry) { + echo $this->db_onedev->last_query(); + echo json_encode([ + "status" => "ERR", + "message" => "Error get order | " . $this->db_onedev->error()["message"] + ]); + exit; + } + + $rows = $qry->result_array(); + $results = []; + + + + foreach ($rows as $r) { + $result_value = $r['T_OrderDetailResult']; + + $value_comparison = 0; + //echo $r['Mcu_SummaryLabIsNormalValue']; + $kelainan = []; + $notavailable = []; + if (trim($result_value) == 'NA') { + $notavailable = $r; + } elseif ($r['Mcu_SummaryLabIsNormalValue'] == 'Y') { + if ($r['Mcu_SummaryLabType'] == '<' || $r['Mcu_SummaryLabType'] == '<=') { + $value_comparison = $r['T_OrderDetailMinValue']; + } + if ($r['Mcu_SummaryLabType'] == '>' || $r['Mcu_SummaryLabType'] == '>=') { + $value_comparison = $r['T_OrderDetailMaxValue']; + } + if ($r['Mcu_SummaryLabType'] == '!=') { + $result_value = strtolower(trim($result_value)); + $value_comparison = strtolower(trim($r['T_OrderDetailNormalValueNote'])); + } + + + + //echo "Y"; + if ($r['Mcu_SummaryLabWithMethode'] == 'N' && $this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } else if ($r['Mcu_SummaryLabIsRange'] == 'Y') { + // Mcu_SummaryLabIsNormalValue, + // Mcu_SummaryLabIsRange, + // Mcu_SummaryLabMinInclusive, + // Mcu_SummaryLabMinValue, + // Mcu_SummaryLabMaxInclusive, + // Mcu_SummaryLabMaxValue, + $isWithinMin = $r['Mcu_SummaryLabMinInclusive'] === 'Y' ? floatval($result_value) >= floatval($r['Mcu_SummaryLabMinValue']) : floatval($result_value) > floatval($r['Mcu_SummaryLabMinValue']); + $isWithinMax = $r['Mcu_SummaryLabMaxInclusive'] === 'Y' ? floatval($result_value) <= floatval($r['Mcu_SummaryLabMaxValue']) : floatval($result_value) < floatval($r['Mcu_SummaryLabMaxValue']); + + if ($isWithinMax && $isWithinMin) { + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } else { + $value_comparison = $r['Mcu_SummaryLabValue']; + if ($r['Mcu_SummaryLabType'] == '!=' || $r['Mcu_SummaryLabType'] == '==') { + if ($this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } else { + if (is_numeric($result_value) && $this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } + } + + if (count($results) > 0) { + $sql = "UPDATE t_kelainan_lab + SET T_KelainanLabIsActive = 'N' + WHERE + T_KelainanLabT_OrderHeaderID = {$orderid}"; + $this->db_onedev->query($sql); + + foreach ($results as $v_result) { + $sql_kel_lab = "SELECT * + FROM t_kelainan_lab + WHERE T_KelainanLabT_OrderDetailID = ? + GROUP BY T_KelainanLabT_OrderDetailID"; + $qry_kel_lab = $this->db_onedev->query($sql_kel_lab, array($v_result['orderdetailID'])); + if ($qry_kel_lab) { + $rows_kel = $qry_kel_lab->result_array(); + } else { + $this->sys_error_db("select kelainan lab", $this->db_onedev); + exit; + } + + if (count($rows_kel) > 0) { + + // print_r($v_result['orderdetailID']); + // exit; + + $sql_update_kel = "UPDATE t_kelainan_lab + SET T_KelainanLabT_OrderDetailID = {$v_result['orderdetailID']}, + T_KelainanLabT_OrderHeaderID = {$v_result['orderheaderID']}, + T_KelainanLabNat_TestID = {$v_result['nat_testID']}, + T_KelainanLabMcu_SummaryLabID = {$v_result['mcu_summarylabID']}, + T_KelainanLabCreatedUserID = 1, + T_KelainanLabIsActive = 'Y', + T_KelainanLabCreated = NOW() + WHERE T_KelainanLabID = {$rows_kel[0]['T_KelainanLabID']}"; + $qry_update_kel = $this->db_onedev->query($sql_update_kel); + if (!$qry_update_kel) { + echo $this->db_onedev->last_query(); + //$this->db_onedev->trans_rollback(); + $this->sys_error_db('error', 'Error update lab: ' . $this->db_onedev); + exit; + } + } else { + // print_r('insert'); + // exit; + $sql_insert_lab = "INSERT INTO t_kelainan_lab( + T_KelainanLabT_OrderDetailID, + T_KelainanLabT_OrderHeaderID, + T_KelainanLabNat_TestID, + T_KelainanLabMcu_SummaryLabID, + T_KelainanLabCreatedUserID, + T_KelainanLabCreated) + VALUES( + '{$v_result['orderdetailID']}', + '{$v_result['orderheaderID']}', + '{$v_result['nat_testID']}', + '{$v_result['mcu_summarylabID']}', + 1, + NOW())"; + $qry_insert_lab = $this->db_onedev->query($sql_insert_lab); + + if (!$qry_insert_lab) { + //$this->db_onedev->trans_rollback(); + echo $this->db_onedev->last_query(); + $this->sys_error_db('error', 'Error insert kelainan lab: ' . $this->db_onedev); + exit; + } + } + } + } + } + } + + function generate_kelainan_lab_x($orderid) + { + $sql = "SELECT + T_OrderHeaderID,T_OrderHeaderLabNumber, + T_TestName, T_OrderDetailID, T_OrderDetailResult, T_OrderDetailNat_MethodeID, + T_OrderDetailNat_MethodeID, T_OrderDetailNat_MethodeName, + T_OrderDetailMinValue, T_OrderDetailMaxValue, T_OrderDetailMinValueInclusive, + T_OrderDetailMaxValueInclusive, + Mcu_SummaryLabID, + Mcu_SummaryLabValue, + Mcu_SummaryLabNat_MethodeID, + Mcu_SummaryLabWithMethode, + Mcu_SummaryLabType, + Mcu_SummaryLabIsNormalValue, + Mcu_SummaryLabIsRange, + Mcu_SummaryLabMinInclusive, + Mcu_SummaryLabMinValue, + Mcu_SummaryLabMaxInclusive, + Mcu_SummaryLabMaxValue, + Mcu_KelainanID, Mcu_KelainanName, Mcu_KelainanClasification, + Nat_TestID, + Nat_TestCode, + mcu_kelainangroup.* + from t_orderdetail + join t_orderheader on T_OrderHeaderID = {$orderid} + and T_OrderHeaderID = T_OrderDetailT_OrderHeaderID + and T_OrderDetailIsActive = 'Y' + JOIN m_patient + ON T_OrderHeaderM_PatientID = M_PatientID + join t_test + on T_OrderDetailT_TestID = T_TestID + join nat_test ON T_TestNat_TestID = Nat_TestID + join mcu_summarylab on T_TestNat_TestID = Mcu_SummaryLabNat_TestID AND Mcu_SummaryLabIsActive = 'Y' + AND (Mcu_SummaryLabGender = 'A' OR (Mcu_SummaryLabGender <> 'A' AND Mcu_SummaryLabGender = CASE + WHEN LOWER(M_PatientGender) = 'male' THEN 'M' + WHEN LOWER(M_PatientGender) = 'female' THEN 'F' + else '' + END)) + join mcu_kelainan on Mcu_SummaryLabMcu_KelainanID = Mcu_KelainanID + join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID"; + //echo $sql; + $qry = $this->db_onedev->query($sql); + if (!$qry) { + echo $this->db_onedev->last_query(); + echo json_encode([ + "status" => "ERR", + "message" => "Error get order | " . $this->db_onedev->error()["message"] + ]); + exit; + } + + $rows = $qry->result_array(); + $results = []; + + + + foreach ($rows as $r) { + $result_value = $r['T_OrderDetailResult']; + + $value_comparison = 0; + //echo $r['Mcu_SummaryLabIsNormalValue']; + $kelainan = []; + $notavailable = []; + if (trim($result_value) == 'NA') { + $notavailable = $r; + } elseif ($r['Mcu_SummaryLabIsNormalValue'] == 'Y') { + if ($r['Mcu_SummaryLabType'] == '<' || $r['Mcu_SummaryLabType'] == '<=') { + $value_comparison = $r['T_OrderDetailMinValue']; + } + if ($r['Mcu_SummaryLabType'] == '>' || $r['Mcu_SummaryLabType'] == '>=') { + $value_comparison = $r['T_OrderDetailMaxValue']; + } + //echo "Y"; + if ($r['Mcu_SummaryLabWithMethode'] == 'N' && $this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } else if ($r['Mcu_SummaryLabIsRange'] == 'Y') { + // Mcu_SummaryLabIsNormalValue, + // Mcu_SummaryLabIsRange, + // Mcu_SummaryLabMinInclusive, + // Mcu_SummaryLabMinValue, + // Mcu_SummaryLabMaxInclusive, + // Mcu_SummaryLabMaxValue, + $isWithinMin = $r['Mcu_SummaryLabMinInclusive'] === 'Y' ? floatval($result_value) >= floatval($r['Mcu_SummaryLabMinValue']) : floatval($result_value) > floatval($r['Mcu_SummaryLabMinValue']); + $isWithinMax = $r['Mcu_SummaryLabMaxInclusive'] === 'Y' ? floatval($result_value) <= floatval($r['Mcu_SummaryLabMaxValue']) : floatval($result_value) < floatval($r['Mcu_SummaryLabMaxValue']); + + if ($isWithinMax && $isWithinMin) { + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } else { + $value_comparison = $r['Mcu_SummaryLabValue']; + if ($r['Mcu_SummaryLabType'] == '!=' || $r['Mcu_SummaryLabType'] == '==') { + if ($this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } else { + if (is_numeric($result_value) && $this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } + } + + if (count($results) > 0) { + $sql = "UPDATE t_kelainan_lab + SET T_KelainanLabIsActive = 'N' + WHERE + T_KelainanLabT_OrderHeaderID = {$orderid}"; + $this->db_onedev->query($sql); + + foreach ($results as $v_result) { + $sql_kel_lab = "SELECT * + FROM t_kelainan_lab + WHERE T_KelainanLabT_OrderDetailID = ? + GROUP BY T_KelainanLabT_OrderDetailID"; + $qry_kel_lab = $this->db_onedev->query($sql_kel_lab, array($v_result['orderdetailID'])); + if ($qry_kel_lab) { + $rows_kel = $qry_kel_lab->result_array(); + } else { + $this->sys_error_db("select kelainan lab", $this->db_onedev); + exit; + } + + if (count($rows_kel) > 0) { + + // print_r($v_result['orderdetailID']); + // exit; + + $sql_update_kel = "UPDATE t_kelainan_lab + SET T_KelainanLabT_OrderDetailID = {$v_result['orderdetailID']}, + T_KelainanLabT_OrderHeaderID = {$v_result['orderheaderID']}, + T_KelainanLabNat_TestID = {$v_result['nat_testID']}, + T_KelainanLabMcu_SummaryLabID = {$v_result['mcu_summarylabID']}, + T_KelainanLabCreatedUserID = 1, + T_KelainanLabIsActive = 'Y', + T_KelainanLabCreated = NOW() + WHERE T_KelainanLabID = {$rows_kel[0]['T_KelainanLabID']}"; + $qry_update_kel = $this->db_onedev->query($sql_update_kel); + if (!$qry_update_kel) { + echo $this->db_onedev->last_query(); + //$this->db_onedev->trans_rollback(); + $this->sys_error_db('error', 'Error update lab: ' . $this->db_onedev); + exit; + } + } else { + // print_r('insert'); + // exit; + $sql_insert_lab = "INSERT INTO t_kelainan_lab( + T_KelainanLabT_OrderDetailID, + T_KelainanLabT_OrderHeaderID, + T_KelainanLabNat_TestID, + T_KelainanLabMcu_SummaryLabID, + T_KelainanLabCreatedUserID, + T_KelainanLabCreated) + VALUES( + '{$v_result['orderdetailID']}', + '{$v_result['orderheaderID']}', + '{$v_result['nat_testID']}', + '{$v_result['mcu_summarylabID']}', + 1, + NOW())"; + $qry_insert_lab = $this->db_onedev->query($sql_insert_lab); + + if (!$qry_insert_lab) { + //$this->db_onedev->trans_rollback(); + echo $this->db_onedev->last_query(); + $this->sys_error_db('error', 'Error insert kelainan lab: ' . $this->db_onedev); + exit; + } + } + } + } + } + } + + function dynamic_comparison($varleft, $op, $varright) + { + + switch ($op) { + case "=": + return $varleft == $varright; + case "!=": + return $varleft != $varright; + case ">=": + return $varleft >= $varright; + case "<=": + return $varleft <= $varright; + case ">": + return $varleft > $varright; + case "<": + return $varleft < $varright; + default: + return true; + } + } + + function generate_kelainan_lab_old($orderid) + { + $sql = "select + T_OrderHeaderID,T_OrderHeaderLabNumber, + T_TestName, T_OrderDetailID, T_OrderDetailResult, T_OrderDetailNat_MethodeID, + T_OrderDetailNat_MethodeID, T_OrderDetailNat_MethodeName, + T_OrderDetailMinValue, T_OrderDetailMaxValue, T_OrderDetailMinValueInclusive, + T_OrderDetailMaxValueInclusive, + Mcu_SummaryLabID, + Mcu_SummaryLabValue, + Mcu_SummaryLabNat_MethodeID, + Mcu_SummaryLabWithMethode, + Mcu_SummaryLabType, + Mcu_SummaryLabIsNormalValue, + Mcu_KelainanID, Mcu_KelainanName, Mcu_KelainanClasification, + Nat_TestID, + Nat_TestCode, + mcu_kelainangroup.* + from t_orderdetail + join t_orderheader on T_OrderHeaderID = {$orderid} + and T_OrderHeaderID = T_OrderDetailT_OrderHeaderID + and T_OrderDetailIsActive = 'Y' + join t_test + on T_OrderDetailT_TestID = T_TestID + join nat_test ON T_TestNat_TestID = Nat_TestID + join mcu_summarylab on T_TestNat_TestID = Mcu_SummaryLabNat_TestID AND Mcu_SummaryLabIsActive = 'Y' + join mcu_kelainan on Mcu_SummaryLabMcu_KelainanID = Mcu_KelainanID + join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID"; + //echo $sql; + $qry = $this->db_onedev->query($sql); + if (!$qry) { + echo $this->db_onedev->last_query(); + echo json_encode([ + "status" => "ERR", + "message" => "Error get order | " . $this->db_onedev->error()["message"] + ]); + exit; + } + + $rows = $qry->result_array(); + $results = []; + + + + foreach ($rows as $r) { + $result_value = $r['T_OrderDetailResult']; + + $value_comparison = 0; + //echo $r['Mcu_SummaryLabIsNormalValue']; + $kelainan = []; + $notavailable = []; + if (trim($result_value) == 'NA') { + $notavailable = $r; + } elseif ($r['Mcu_SummaryLabIsNormalValue'] == 'Y') { + if ($r['Mcu_SummaryLabType'] == '<' || $r['Mcu_SummaryLabType'] == '<=') { + $value_comparison = $r['T_OrderDetailMinValue']; + } + if ($r['Mcu_SummaryLabType'] == '>' || $r['Mcu_SummaryLabType'] == '>=') { + $value_comparison = $r['T_OrderDetailMaxValue']; + } + //echo "Y"; + if ($r['Mcu_SummaryLabWithMethode'] == 'N' && $this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } else { + $value_comparison = $r['Mcu_SummaryLabValue']; + if ($r['Mcu_SummaryLabType'] == '!=' || $r['Mcu_SummaryLabType'] == '==') { + if ($this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } else { + if (is_numeric($result_value) && $this->dynamic_comparison($result_value, $r['Mcu_SummaryLabType'], $value_comparison)) { + //echo $r['T_TestName']." : ".$r['Mcu_KelainanName'].", "; + $kelainan = $r; + $results[] = array('test' => $r['T_TestName'], 'nat_test' => $r['Nat_TestCode'], 'kelainan' => $r['Mcu_KelainanName'], 'orderdetailID' => $r['T_OrderDetailID'], 'orderheaderID' => $r['T_OrderHeaderID'], 'nat_testID' => $r['Nat_TestID'], 'mcu_summarylabID' => $r['Mcu_SummaryLabID']); + } + } + } + + if (count($results) > 0) { + $sql = "UPDATE t_kelainan_lab + SET T_KelainanLabIsActive = 'N' + WHERE + T_KelainanLabT_OrderHeaderID = {$orderid}"; + $this->db_onedev->query($sql); + + foreach ($results as $v_result) { + $sql_kel_lab = "SELECT * + FROM t_kelainan_lab + WHERE T_KelainanLabT_OrderDetailID = ? + GROUP BY T_KelainanLabT_OrderDetailID"; + $qry_kel_lab = $this->db_onedev->query($sql_kel_lab, array($v_result['orderdetailID'])); + if ($qry_kel_lab) { + $rows_kel = $qry_kel_lab->result_array(); + } else { + $this->sys_error_db("select kelainan lab", $this->db_onedev); + exit; + } + + if (count($rows_kel) > 0) { + + $sql_update_kel = "UPDATE t_kelainan_lab + SET T_KelainanLabT_OrderDetailID = {$v_result['orderdetailID']}, + T_KelainanLabT_OrderHeaderID = {$v_result['orderheaderID']}, + T_KelainanLabNat_TestID = {$v_result['nat_testID']}, + T_KelainanLabMcu_SummaryLabID = {$v_result['mcu_summarylabID']}, + T_KelainanLabCreatedUserID = 1, + T_KelainanLabIsActive = 'Y', + T_KelainanLabCreated = NOW() + WHERE T_KelainanLabID = {$rows_kel[0]['T_KelainanLabID']}"; + $qry_update_kel = $this->db_onedev->query($sql_update_kel); + if (!$qry_update_kel) { + echo $this->db_onedev->last_query(); + //$this->db_onedev->trans_rollback(); + $this->sys_error_db('error', 'Error update lab: ' . $this->db_onedev); + exit; + } + } else { + // print_r('insert'); + // exit; + $sql_insert_lab = "INSERT INTO t_kelainan_lab( + T_KelainanLabT_OrderDetailID, + T_KelainanLabT_OrderHeaderID, + T_KelainanLabNat_TestID, + T_KelainanLabMcu_SummaryLabID, + T_KelainanLabCreatedUserID, + T_KelainanLabCreated) + VALUES( + '{$v_result['orderdetailID']}', + '{$v_result['orderheaderID']}', + '{$v_result['nat_testID']}', + '{$v_result['mcu_summarylabID']}', + 1, + NOW())"; + $qry_insert_lab = $this->db_onedev->query($sql_insert_lab); + + if (!$qry_insert_lab) { + //$this->db_onedev->trans_rollback(); + echo $this->db_onedev->last_query(); + $this->sys_error_db('error', 'Error insert kelainan lab: ' . $this->db_onedev); + exit; + } + } + } + } + } + } + + function insert_data_etl($data,$userid){ + if($data){ + + /*$sql = "UPDATE mcu_fisikvalue SET + Mcu_FisikValueIsActive = 'N', + Mcu_FisikValueLastUpdated = NOW() , + Mcu_FisikValueLastUpdatedUserID = ? + WHERE + Mcu_FisikValueT_OrderHeaderID = ? AND + Mcu_FisikValueCode = ? AND + Mcu_FisikValueIsActive = 'Y'"; + $qry = $this->db_smartone->query($sql,array($userid,$data['order_id'],$data['code'])); + if (! $qry) { + return false; + }*/ + + $sql = "SELECT COUNT(*) as xcount, Mcu_FisikValueID as id + FROM mcu_fisikvalue + WHERE + Mcu_FisikValueT_OrderHeaderID = ? AND + Mcu_FisikValueCode = ? + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql,array($data['order_id'],$data['code'])); + if (! $qry) { + return false; + } + + //echo $this->db_smartone->last_query(); + //print_r($data); + //echo $data['code']; + /*if($data['code'] == 'bmi_classification_asia_pacific'){ + echo $this->db_smartone->last_query(); + }*/ + + $exist_dt = $qry->row_array(); + /*if($data['code'] == 'bmi_classification_asia_pacific'){ + print_r($exist_dt); + }*/ + + if($exist_dt['xcount'] > 0){ + $sql = "UPDATE mcu_fisikvalue SET + Mcu_FisikValueIsActive = 'Y', + Mcu_FisikValueLastUpdated = NOW() , + Mcu_FisikValueLastUpdatedUserID = ?, + Mcu_FisikValueLabel = ?, + Mcu_FisikValueNote = ?, + Mcu_FisikValueSegment = ?, + Mcu_FisikValueCategory = ? + WHERE + Mcu_FisikValueID = ? + "; + $qry = $this->db_smartone->query($sql,array($userid,$data['label'],$data['note'],$data['segment'],$data['category'],$exist_dt['id'])); + }else{ + $sql = "INSERT INTO mcu_fisikvalue ( + `Mcu_FisikValueT_OrderHeaderID`, + `Mcu_FisikValueCode`, + `Mcu_FisikValueLabel`, + `Mcu_FisikValueNote`, + `Mcu_FisikValueSegment`, + `Mcu_FisikValueCategory`, + `Mcu_FisikValueCreated`, + `Mcu_FisikValueCreatedUserID` + ) VALUES(?,?,?,?,?,?,NOW(),?)"; + $qry = $this->db_smartone->query($sql,array( + $data['order_id'], + $data['code'], + $data['label'], + $data['note'], + $data['segment'], + $data['category'], + $userid + )); + if (! $qry) { + return false; + } + } + } + } + + function generate_all_fisik($orderID,$userid){ + $this->status_gizi($orderID,$userid); + $this->persepsi_warna($orderID,$userid); + $this->visus($orderID,$userid); + + $sql = "SELECT * + FROM so_resultentry + WHERE + So_ResultEntryNonlab_TemplateID = 27 AND + So_ResultEntryT_OrderHeaderID = ? AND + So_ResultEntryIsActive = 'Y' + LIMIT 1"; + $qry = $this->db_smartone->query($sql,array($orderID)); + if (! $qry) { + return false; + } + //echo $this->db_smartone->last_query(); + $results = $qry->result_array(); + if(count($results) > 0){ + $soReID = $results[0]['So_ResultEntryID']; + + $this->keluhan($soReID,$userid); + $this->riwayat_penyakit($soReID,$userid); + $this->penyakit_keluarga($soReID,$userid); + $this->kebiasaan_hidup($soReID,$userid); + $this->fisik_konsumsiobatteratur($soReID,$userid); + $this->imunasi($soReID,$userid); + $this->vital_sign($soReID,$userid); + $this->keadaan_umum($soReID,$userid); + $this->kepala_wajah($soReID,$userid); + $this->mata($soReID,$userid); + $this->lapang_pandang($soReID,$userid); + $this->telinga($soReID,$userid); + $this->hidung($soReID,$userid); + $this->gigi($soReID,$userid); + $this->mulut($soReID,$userid); + $this->leher($soReID,$userid); + $this->thorax($soReID,$userid); + $this->paru($soReID,$userid); + $this->jantung($soReID,$userid); + $this->perut($soReID,$userid); + $this->sistem_integumen($soReID,$userid); + $this->genitourinaria($soReID,$userid); + $this->anggota_gerak($soReID,$userid); + $this->sistem_persyarafan($soReID,$userid); + $this->smell_test($soReID,$userid); + $this->low_back_pain_screening_test($soReID,$userid); + $this->loop_k3($soReID,$userid); + + } + + return true; + } + + function visus($orderID,$userid) { + $ret_array = []; + + $sql = " SELECT * , T_SamplingAdditionalFisikVisusID as visus_id + FROM t_samplingso_additional_fisik_visus + WHERE + T_SamplingAdditionalFisikVisusT_OrderHeaderID = ? LIMIT 1"; + $qry = $this->db_smartone->query($sql,array($orderID)); + if (! $qry) { + return false; + } + + $row_result = $qry->row_array(); + //echo $this->db_smartone->last_query(); + + + if($row_result && intval($row_result['visus_id']) > 0){ + + + + $visus = array(); + $visus_kiri = ""; + $visus_kanan = ""; + $visus_kesimpulan = ""; + $normal = array("20/20", "20/25","6/6","6/7.5","6/7,5"); + $miopia_od = false; + $miopia_os = false; + $miopia_od_value = ''; + $miopia_os_value = ''; + $astigmatismus_od = false; + $astigmatismus_os = false; + $astigmatismus_od_value = ''; + $astigmatismus_os_value = ''; + $presbiopia_ods = false; + $presbiopia_ods_value = ''; + $x_od = false; + $x_os = false; + $x_od_value = ""; + $x_os_value = ""; + $od_visus = "20/20"; + $os_visus = "20/20"; + if($row_result['T_SamplingAdditionalFisikVisusTKODV'] == '6/7,5' || $row_result['T_SamplingAdditionalFisikVisusTKODV'] == '6/6' || $row_result['T_SamplingAdditionalFisikVisusTKODV'] == '6/7.5') + $od_visus = $row_result['T_SamplingAdditionalFisikVisusTKODV'] ; + + if($row_result['T_SamplingAdditionalFisikVisusTKOSV'] == '6/7,5' || $row_result['T_SamplingAdditionalFisikVisusTKOSV'] == '6/6' || $row_result['T_SamplingAdditionalFisikVisusTKOSV'] == '6/7.5') + $os_visus = $row_result['T_SamplingAdditionalFisikVisusTKOSV'] ; + + + + if((strtolower($row_result['T_SamplingAdditionalFisikVisusTKODV']) != "normal" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "-" && strtolower($row_result['T_SamplingAdditionalFisikVisusTKODV']) != "normal" && strtolower($row_result['T_SamplingAdditionalFisikVisusTKOSV']) != "normal")){ + $visus[] = array( + "xx1" => "Tanpa Kacamata", + "xx2" => "OD : ", + "xx3" => $row_result['T_SamplingAdditionalFisikVisusTKODV'] + ); + + $visus[] = array( + "xx1" => "Tanpa Kacamata", + "xx2" => "OS", + "xx3" => $row_result['T_SamplingAdditionalFisikVisusTKOSV'] + ); + + + $rst['kelainan'] = "Kelainan refraksi (tanpa kacamata)"; + + if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKODV'], $normal)){ + $value_koreksi_od = ""; + $od_sph = $row_result['T_SamplingAdditionalFisikVisusODSPH']; + if($od_sph != "" && $od_sph != "-" && $od_sph != "--" && $od_sph != "/-" && $od_sph != "/" && $od_sph != "-/" && strtolower(trim($od_sph)) != 'plano'){ + if ($visus_kanan != "") $visus_kanan .= ", "; + $visus_kanan .= $od_sph." (Miopia)"; + + $miopia_od = true; + $miopia_od_value = $od_sph; + } + + + $od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL']; + + //$od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL']; + if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/"){ + if ($visus_kanan != "") $visus_kanan .= ", "; + $visus_kanan .= "Cyl ".$od_cyl; + + $astigmatismus_od = true; + $astigmatismus_od_value = $od_cyl; + } + + + $od_x = $row_result['T_SamplingAdditionalFisikVisusODX']; + //echo $od_x; + if($od_x != "" && $od_x != "-" && $od_x != "--" && $od_x != "/-" && $od_x != "/" && $od_x != "-/"){ + $visus_kanan .= " axis ".$od_x." (Astigmatismus)"; + $x_od = true; + $x_od = $od_x; + }else{ + if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/") + $visus_kanan .= " (Astigmatismus)"; + } + //$value_koreksi_od .= "X (".$od_x.") "; + + + + } + + if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKOSV'], $normal)){ + $value_koreksi_os = ""; + $os_sph = $row_result['T_SamplingAdditionalFisikVisusOSSPH']; + if(strtolower(trim($os_sph)) != "tidak terkoreksi" && strtolower(trim($os_sph)) != "tidak dapat dinilai" && $os_sph != "" && $os_sph != "-" && $os_sph != "--" && $os_sph != "/-" && $os_sph != "/" && $os_sph != "-/" && strtolower(trim($os_sph)) != 'plano'){ + if ($visus_kiri != "") $visus_kiri .= ", "; + $visus_kiri .= $os_sph." (Miopia)"; + + $miopia_os = true; + $miopia_os_value = $os_sph; + } + + $os_cyl = $row_result['T_SamplingAdditionalFisikVisusOSCYL']; + + if(strtolower(trim($os_cyl)) != "tidak terkoreksi" && strtolower(trim($os_cyl)) != "tidak dapat dinilai" && $os_cyl != "" && $os_cyl != "-" && $os_cyl != "--" && $os_cyl != "/-" && $os_cyl != "/" && $os_cyl != "-/"){ + if ($visus_kiri != "") $visus_kiri .= ", "; + $visus_kiri .= "Cyl ".$os_cyl; + + $astigmatismus_os = true; + $astigmatismus_os_value = $os_cyl; + } + + + $os_x = $row_result['T_SamplingAdditionalFisikVisusOSX']; + + if(strtolower(trim($os_x)) != "tidak terkoreksi" && strtolower(trim($os_x)) != "tidak dapat dinilai" && $os_x != "" && $os_x != "-" && $os_x != "--" && $os_x != "/-" && $os_x != "/" && $os_x != "-/"){ + //if ($visus_kiri != "") $visus_kiri .= ", "; + $visus_kiri .= " axis ".$os_x." (Astigmatismus)"; + $x_os = true; + $x_os = $os_x; + }else{ + if($os_cyl != "" && $os_cyl != "-") + $visus_kiri .= " (Astigmatismus)"; + } + + } + + } + + if((strtolower($row_result['T_SamplingAdditionalFisikVisusDKODV']) != "normal" && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "-" && strtolower($row_result['T_SamplingAdditionalFisikVisusDKODV']) != "normal" && strtolower($row_result['T_SamplingAdditionalFisikVisusDKOSV']) != "normal")){ + $visus[] = array( + "xx1" => "Dengan Kacamata", + "xx2" => "OD : ", + "xx3" => $row_result['T_SamplingAdditionalFisikVisusDKODV'] + ); + + $visus[] = array( + "xx1" => "Dengan Kacamata", + "xx2" => "OS", + "xx3" => $row_result['T_SamplingAdditionalFisikVisusDKOSV'] + ); + + $rst['kelainan'] = "Kelainan refraksi (dengan kacamata)"; + $od_visus = $row_result['T_SamplingAdditionalFisikVisusDKODV'] ; + $os_visus = $row_result['T_SamplingAdditionalFisikVisusDKOSV'] ; + + + $value_koreksi_od = ""; + $od_sph = $row_result['T_SamplingAdditionalFisikVisusODSPH']; + if(strtolower(trim($od_sph)) != "tidak terkoreksi" && strtolower(trim($od_sph)) != "tidak dapat dinilai" && $od_sph != "" && $od_sph != "-" && $od_sph != "--" && $od_sph != "/-" && $od_sph != "/" && $od_sph != "-/" && strtolower(trim($od_sph)) != 'plano'){ + if ($visus_kanan != "") $visus_kanan .= ", "; + $visus_kanan .= $od_sph." (Miopia)"; + + $miopia_od = true; + $miopia_od_value = $od_sph; + } + + $od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL']; + + if(strtolower(trim($od_cyl)) != "tidak terkoreksi" && strtolower(trim($od_cyl)) != "tidak dapat dinilai" && $od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/"){ + if ($visus_kanan != "") $visus_kanan .= ", "; + $visus_kanan .= "Cyl ".$od_cyl; + + $astigmatismus_od = true; + $astigmatismus_od_value = $od_cyl; + } + + $od_x = $row_result['T_SamplingAdditionalFisikVisusODX']; + if(strtolower(trim($od_x)) != "tidak terkoreksi" && strtolower(trim($od_x)) != "tidak dapat dinilai" && $od_x != "" && $od_x != "-" && $od_x != "--" && $od_x != "/-" && $od_x != "/" && $od_x != "-/"){ + //if ($visus_kanan != "") $visus_kanan .= ", "; + $visus_kanan .= " axis ".$od_x." (Astigmatismus)"; + $x_od = true; + $x_od = $od_x; + }else{ + if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/") + $visus_kanan .= " (Astigmatismus)"; + } + //$value_koreksi_od .= "X (".$od_x.") "; + + + + + + $value_koreksi_os = ""; + $os_sph = $row_result['T_SamplingAdditionalFisikVisusOSSPH']; + if(strtolower(trim($os_sph)) != "tidak terkoreksi" && strtolower(trim($os_sph)) != "tidak dapat dinilai" && $os_sph != "" && $os_sph != "-" && $os_sph != "--" && $os_sph != "/-" && $os_sph != "/" && $os_sph != "-/" && strtolower(trim($os_sph)) != 'plano'){ + if ($visus_kiri != "") $visus_kiri .= ", "; + $visus_kiri .= $os_sph." (Miopia)"; + + $miopia_os = true; + $miopia_os_value = $os_sph; + } + + $os_cyl = $row_result['T_SamplingAdditionalFisikVisusOSCYL']; + + if(strtolower(trim($os_cyl)) != "tidak terkoreksi" && strtolower(trim($os_cyl)) != "tidak dapat dinilai" && $os_cyl != "" && $os_cyl != "-" && $os_cyl != "--" && $os_cyl != "/-" && $os_cyl != "/" && $os_cyl != "-/"){ + if ($visus_kiri != "") $visus_kiri .= ", "; + $visus_kiri .= "Cyl ".$os_cyl; + + $astigmatismus_os = true; + $astigmatismus_os_value = $os_cyl; + } + + $os_x = $row_result['T_SamplingAdditionalFisikVisusOSX']; + + if(strtolower(trim($os_x)) != "tidak terkoreksi" && strtolower(trim($os_x)) != "tidak dapat dinilai" && $os_x != "" && $os_x != "-" && $os_x != "--" && $os_x != "/-" && $os_x != "/" && $os_x != "-/"){ + $visus_kiri .= " axis ".$os_x." (Astigmatismus)"; + $x_os = true; + $x_os = $os_x; + }else{ + if($os_cyl != "" && $os_cyl != "-" && $os_cyl != "--" && $os_cyl != "/-" && $os_cyl != "/" && $os_cyl != "-/") + $visus_kiri .= " (Astigmatismus)"; + } + //$value_koreksi_os .= "X (".$os_x.") "; + + + } + + if(($row_result['T_SamplingAdditionalFisikVisusTKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "-")){ + if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKODV'], $normal) && $visus_kanan == ''){ + $visus_kanan = "Miopia"; + $miopia_od = true; + $miopia_od_value = ""; + } + + if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKOSV'], $normal) && $visus_kiri == ''){ + $visus_kiri = "Miopia"; + $miopia_os = true; + $miopia_os_value = ""; + } + } + + if(($row_result['T_SamplingAdditionalFisikVisusDKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "-")){ + if (!in_array($row_result['T_SamplingAdditionalFisikVisusDKODV'], $normal) && $visus_kanan == ''){ + $visus_kanan = "Miopia"; + $miopia_od = true; + $miopia_od_value = ""; + } + + if (!in_array($row_result['T_SamplingAdditionalFisikVisusDKOSV'], $normal) && $visus_kiri == ''){ + $visus_kiri = "Miopia"; + $miopia_os = true; + $miopia_os_value = ""; + } + } + + $od_add = $row_result['T_SamplingAdditionalFisikVisusADD']; + if($od_add != "" && $od_add != "-" && $od_add != "--" && $od_add != "/-" && $od_add != "/" && $od_add != "-/"){ + if ($visus_kanan != "") $visus_kanan .= ", "; + $visus_kanan .= $od_add." (Presbiopia)"; + + if ($visus_kiri != "") $visus_kiri .= ", "; + $visus_kiri .= $od_add." (Presbiopia)"; + + + $presbiopia_ods = true; + $presbiopia_ods_value = $od_add; + } + + + + } + + $data_insert = array( + 'code' => 'visus', + 'label' => 'visus', + 'note' => $rst['kelainan'], + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus','visus'); + + if($miopia_od){ + $data_insert = array( + 'code' => 'visus_miopia_od', + 'label' => 'visus Miopia OD', + 'note' => $miopia_od_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_miopia_od','visus Miopia OD'); + } + if($miopia_os){ + $data_insert = array( + 'code' => 'visus_miopia_os', + 'label' => 'visus Miopia OS', + 'note' => $miopia_os_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_miopia_os','visus Miopia OS'); + } + if($miopia_od){ + $in_value = ["20/30","20/40"]; + $exp_value_od = explode("/",$od_visus); + if(isset($exp_value_od[1]) && intval($exp_value_od[1]) < 50){ + $data_insert = array( + 'code' => 'visus_miopia_od_30_40', + 'label' => 'visus Miopia OD 20/30 20/40', + 'note' => $miopia_od_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_miopia_od_30_40','visus Miopia OD 20/30 20/40'); + } + if(isset($exp_value_od[1]) && intval($exp_value_od[1]) > 50){ + $data_insert = array( + 'code' => 'visus_miopia_od_over_50', + 'label' => 'visus Miopia OD > 20/50', + 'note' => $miopia_od_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_miopia_ods_over_50','visus Miopia ODS > 20/50'); + } + } + + if($miopia_os){ + + $in_value = ["20/30","20/40"]; + $exp_value_os = explode("/",$os_visus); + //print_r($exp_value_os); + if(isset($exp_value_os[1]) && intval($exp_value_os[1]) < 50){ + $data_insert = array( + 'code' => 'visus_miopia_os_30_40', + 'label' => 'visus Miopia OS 20/30 20/40', + 'note' => $miopia_os_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_miopia_od_30_40','visus Miopia OD 20/30 20/40'); + } + if(isset($exp_value_os[1]) && intval($exp_value_os[1]) > 50){ + $data_insert = array( + 'code' => 'visus_miopia_os_over_50', + 'label' => 'visus Miopia OS > 20/50', + 'note' => $miopia_os_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_miopia_ods_over_50','visus Miopia ODS > 20/50'); + } + } + + if($astigmatismus_od){ + $data_insert = array( + 'code' => 'visus_astigmatismus_od', + 'label' => 'visus Astigmatismus OD', + 'note' => $astigmatismus_od_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_astigmatismus_od','visus Astigmatismus OD'); + } + if($astigmatismus_os){ + $data_insert = array( + 'code' => 'visus_astigmatismus_os', + 'label' => 'visus Astigmatismus OS', + 'note' => $astigmatismus_os_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_astigmatismus_os','visus Astigmatismus OS'); + } + if($astigmatismus_od && $astigmatismus_os){ + $data_insert = array( + 'code' => 'visus_astigmatismus_ods', + 'label' => 'visus Astigmatismus ODS', + 'note' => $astigmatismus_os_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_astigmatismus_ods','visus Astigmatismus ODS'); + } + if($x_od){ + $data_insert = array( + 'code' => 'visus_x_od', + 'label' => 'visus X OD', + 'note' => $x_od_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_x_od','visus X OD'); + } + if($x_os){ + $data_insert = array( + 'code' => 'visus_x_os', + 'label' => 'visus X OS', + 'note' => $x_od_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_x_os','visus X OS'); + } + if($presbiopia_ods){ + $data_insert = array( + 'code' => 'visus_presbiopia_ods', + 'label' => 'visus Presbiopia ODS', + 'note' => $presbiopia_ods_value, + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('visus_presbiopia_ods','visus Presbiopia ODS'); + } + } + + function visus_old($orderID,$userid) { + $sql = " SELECT * , T_SamplingAdditionalFisikVisusID as visus_id + FROM t_samplingso_additional_fisik_visus + WHERE + T_SamplingAdditionalFisikVisusT_OrderHeaderID = ? LIMIT 1"; + $qry = $this->db_smartone->query($sql,array($orderID)); + if (! $qry) { + return false; + } + + $row_result = $qry->row_array(); + + + $visus = array(); + $visus_kiri = ""; + $visus_kanan = ""; + $visus_kesimpulan = ""; + $normal = array("20/20", "20/25"); + $rst['kelainan'] = "Normal"; + $miopia_od = false; + $miopia_os = false; + $miopia_od_value = ''; + $miopia_os_value = ''; + $astigmatismus_od = false; + $astigmatismus_os = false; + $astigmatismus_od_value = ''; + $astigmatismus_os_value = ''; + $presbiopia_od = false; + $presbiopia_os = false; + $presbiopia_od_value = ''; + $presbiopia_os_value = ''; + + if($row_result){ + if(($row_result['T_SamplingAdditionalFisikVisusTKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "-")){ + $visus[] = array( + "xx1" => "Tanpa Kacamata", + "xx2" => "OD : ", + "xx3" => $row_result['T_SamplingAdditionalFisikVisusTKODV'] + ); + + $visus[] = array( + "xx1" => "Tanpa Kacamata", + "xx2" => "OS", + "xx3" => $row_result['T_SamplingAdditionalFisikVisusTKOSV'] + ); + + $rst['kelainan'] = "Kelainan refraksi (tanpa kacamata)"; + + if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKODV'], $normal)){ + $value_koreksi_od = ""; + $od_sph = $row_result['T_SamplingAdditionalFisikVisusODSPH']; + if($od_sph != "" && $od_sph != "-" && $od_sph != "--" && $od_sph != "/-" && $od_sph != "/" && $od_sph != "-/" && strtolower(trim($od_sph)) != 'plano'){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Miopia OD"; + + $miopia_od = true; + $miopia_od_value = $od_sph; + } + + $od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL']; + if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/"){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Astigmatismus OD"; + + $astigmatismus_od = true; + $astigmatismus_od_value = $od_cyl; + } + + + $od_x = $row_result['T_SamplingAdditionalFisikVisusODX']; + if($od_x != "" && $od_x != "-" && $od_x != "--" && $od_x != "/-" && $od_x != "/" && $od_x != "-/") + $value_koreksi_od .= "X (".$od_x.") "; + + $od_add = $row_result['T_SamplingAdditionalFisikVisusADD']; + if($od_add != "" && $od_add != "-" && $od_add != "--" && $od_add != "/-" && $od_add != "/" && $od_add != "-/"){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Presbiopia OD"; + + $presbiopia_od = true; + + $presbiopia_od_value = ""; + $presbiopia_os_value = ""; + + } + + } + + if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKOSV'], $normal)){ + $value_koreksi_os = ""; + $os_sph = $row_result['T_SamplingAdditionalFisikVisusOSSPH']; + if(strtolower(trim($os_sph)) != "tidak terkoreksi" && strtolower(trim($os_sph)) != "tidak dapat dinilai" && $os_sph != "" && $os_sph != "-" && $os_sph != "--" && $os_sph != "/-" && $os_sph != "/" && $os_sph != "-/" && strtolower(trim($os_sph)) != 'plano'){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Miopia OS"; + } + + + $os_cyl = $row_result['T_SamplingAdditionalFisikVisusOSCYL']; + if(strtolower(trim($os_cyl)) != "tidak terkoreksi" && strtolower(trim($os_cyl)) != "tidak dapat dinilai" && $os_cyl != "" && $os_cyl != "-" && $os_cyl != "--" && $os_cyl != "/-" && $os_cyl != "/" && $os_cyl != "-/"){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Astigmatismus OS"; + } + + + $os_x = $row_result['T_SamplingAdditionalFisikVisusOSX']; + if(strtolower(trim($os_x)) != "tidak terkoreksi" && strtolower(trim($os_x)) != "tidak dapat dinilai" && $os_x != "" && $os_x != "-" && $os_x != "--" && $os_x != "/-" && $os_x != "/" && $os_x != "-/") + $value_koreksi_os .= "X (".$os_x.") "; + + $od_add = $row_result['T_SamplingAdditionalFisikVisusADD']; + if($od_add != "" && $od_add != "-" && $od_add != "--" && $od_add != "/-" && $od_add != "/" && $od_add != "-/"){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Presbiopia OS"; + } + + + } + } + + if(($row_result['T_SamplingAdditionalFisikVisusDKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "-")){ + $visus[] = array( + "xx1" => "Dengan Kacamata", + "xx2" => "OD : ", + "xx3" => $row_result['T_SamplingAdditionalFisikVisusDKODV'] + ); + + $visus[] = array( + "xx1" => "Dengan Kacamata", + "xx2" => "OS", + "xx3" => $row_result['T_SamplingAdditionalFisikVisusDKOSV'] + ); + + $rst['kelainan'] = "Kelainan refraksi (dengan kacamata)"; + + + $value_koreksi_od = ""; + $od_sph = $row_result['T_SamplingAdditionalFisikVisusODSPH']; + if(strtolower(trim($od_sph)) != "tidak terkoreksi" && strtolower(trim($od_sph)) != "tidak dapat dinilai" && $od_sph != "" && $od_sph != "-" && $od_sph != "--" && $od_sph != "/-" && $od_sph != "/" && $od_sph != "-/" && strtolower(trim($od_sph)) != 'plano'){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Miopia OD"; + } + + + $od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL']; + if(strtolower(trim($od_cyl)) != "tidak terkoreksi" && strtolower(trim($od_cyl)) != "tidak dapat dinilai" && $od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/"){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Astigmatismus OD"; + } + + + $od_x = $row_result['T_SamplingAdditionalFisikVisusODX']; + if(strtolower(trim($od_x)) != "tidak terkoreksi" && strtolower(trim($od_x)) != "tidak dapat dinilai" && $od_x != "" && $od_x != "-" && $od_x != "--" && $od_x != "/-" && $od_x != "/" && $od_x != "-/") + $value_koreksi_od .= "X (".$od_x.") "; + + $od_add = $row_result['T_SamplingAdditionalFisikVisusADD']; + if($od_add != "" && $od_add != "-" && $od_add != "--" && $od_add != "/-" && $od_add != "/" && $od_add != "-/"){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Presbiopia OD"; + } + + + + + $value_koreksi_os = ""; + $os_sph = $row_result['T_SamplingAdditionalFisikVisusOSSPH']; + if(strtolower(trim($os_sph)) != "tidak terkoreksi" && strtolower(trim($os_sph)) != "tidak dapat dinilai" && $os_sph != "" && $os_sph != "-" && $os_sph != "--" && $os_sph != "/-" && $os_sph != "/" && $os_sph != "-/" && strtolower(trim($os_sph)) != 'plano'){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Miopia OS"; + } + + $os_cyl = $row_result['T_SamplingAdditionalFisikVisusOSCYL']; + if(strtolower(trim($os_cyl)) != "tidak terkoreksi" && strtolower(trim($os_cyl)) != "tidak dapat dinilai" && $os_cyl != "" && $os_cyl != "-" && $os_cyl != "--" && $os_cyl != "/-" && $os_cyl != "/" && $os_cyl != "-/"){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Astigmatismus OS"; + } + + $os_x = $row_result['T_SamplingAdditionalFisikVisusOSX']; + if(strtolower(trim($os_x)) != "tidak terkoreksi" && strtolower(trim($os_x)) != "tidak dapat dinilai" && $os_x != "" && $os_x != "-" && $os_x != "--" && $os_x != "/-" && $os_x != "/" && $os_x != "-/") + $value_koreksi_os .= "X (".$os_x.") "; + + $od_add = $row_result['T_SamplingAdditionalFisikVisusADD']; + if($od_add != "" && $od_add != "-" && $od_add != "--" && $od_add != "/-" && $od_add != "/" && $od_add != "-/"){ + if ($visus_kesimpulan != "") $visus_kesimpulan .= ", "; + $visus_kesimpulan .= "Presbiopia OS"; + } + + + } + + $rst['kesimpulan'] = $visus_kesimpulan; + + $data_insert = array( + 'code' => 'visus', + 'label' => 'visus', + 'note' => $rst['kelainan'], + 'segment' => 'visus', + 'category' => 'mata', + 'order_id' => $orderID + ); + $this->insert_data_etl($data_insert,$userid); + } + } + + function insert_code($code,$label){ + /*$sql = "INSERT INTO fisik_template_code( + FisikTemplateCodeName, + FisikTemplateCodeLabel, + FisikTemplateCodeCreated, + FisikTemplateCodeCreatedUserID + ) + VALUES( + ?,?,NOW(),555 + )"; + $qry = $this->db_smartone->query($sql,array($code,$label)); + if (! $qry) { + return false; + }*/ + } + + function status_gizi($id,$userid) { + $sql = "SELECT * + FROM t_samplingso_additional_fisik_bbtb + WHERE + T_SamplingAdditionalFisikBBTBT_OrderHeaderID = ? AND + T_SamplingAdditionalFisikBBTBIsActive = 'Y' + LIMIT 1"; + $qry = $this->db_smartone->query($sql,array($id)); + if (! $qry) { + return false; + } + //echo $this->db_smartone->last_query(); + $row_results = $qry->result_array(); + //print_r($row_result); + if(count($row_results) > 0){ + $row_result = $row_results[0]; + $status_gizi = array(); + $bb = $row_result["T_SamplingAdditionalFisikBBTBValueBB"]; + $tb = $row_result["T_SamplingAdditionalFisikBBTBValueTB"]; + $standart_bmi = $row_result["T_SamplingAdditionalFisikBBTBStandart"]; + $get_bmi = $this->hitung_bmi($bb,$tb,$standart_bmi); + $bmi = $get_bmi['bmi']; + + $classification = $get_bmi['class']; + //echo $classification; + + $data_insert_tb = array( + 'code' => 'tb', + 'label' => $tb, + 'note' => $tb, + 'segment' => 'status_gizi', + 'category' => '', + 'order_id' => $id + ); + $this->insert_data_etl($data_insert_tb,$userid); + //$this->insert_code('tb',$tb); + + $data_insert_bb = array( + 'code' => 'bb', + 'label' => $bb, + 'note' => $bb, + 'segment' => 'status_gizi', + 'category' => '', + 'order_id' => $id + ); + $this->insert_data_etl($data_insert_bb,$userid); + //$this->insert_code('bb',$bb); + + $data_insert_bmi = array( + 'code' => 'bmi', + 'label' => $bmi, + 'note' => $bmi, + 'segment' => 'status_gizi', + 'category' => $standart_bmi, + 'order_id' => $id + ); + $this->insert_data_etl($data_insert_bmi,$userid); + //$this->insert_code('bmi',$bmi); + + $data_insert_bmi_class = array( + 'code' => 'bmi_classification_'.$standart_bmi, + 'label' => $classification, + 'note' => $classification, + 'segment' => 'status_gizi', + 'category' => $standart_bmi, + 'order_id' => $id + ); + //print_r($data_insert_bmi_class); + $this->insert_data_etl($data_insert_bmi_class,$userid); + //$this->insert_code('bmi_classification_'.$standart_bmi,$classification); + } + + return true; + } + + function persepsi_warna($id,$userid) { + $sql = "SELECT IFNULL(T_SamplingAdditionalFisikBWPWValue,'Z') as result, + IFNULL(T_SamplingAdditionalFisikBWPWVAngka,'') as angka + FROM t_samplingso_additional_fisik_bw + WHERE + T_SamplingAdditionalFisikBWT_OrderHeaderID = ? + LIMIT 1"; + $qry = $this->db_smartone->query($sql,array($id)); + if (! $qry) { + return false; + } + + + $row_results = $qry->result_array(); + if(count($row_results) > 0){ + $row_result = $row_results[0]; + $hasil = 'Bahan belum'; + if($row_result['result'] == 'BW'){ + $hasil = 'Red Green Deficiency'; + } + if($row_result['result'] == 'N'){ + $hasil = 'Normal'; + } + if($row_result['result'] == 'X'){ + $hasil = 'Tidak dilakukan'; + } + $data_insert_bw = array( + 'code' => 'bw', + 'label' => $row_result['result'], + 'note' => $hasil, + 'segment' => 'mata', + 'category' => '', + 'order_id' => $id + ); + $this->insert_data_etl($data_insert_bw,$userid); + //$this->insert_code('bw',$row_result['result']); + + $data_insert_bwv = array( + 'code' => 'bw_value', + 'label' => $row_result['angka'], + 'note' => $row_result['angka'], + 'segment' => 'mata', + 'category' => '', + 'order_id' => $id + ); + $this->insert_data_etl($data_insert_bwv,$userid); + //$this->insert_code('bw_value',$row_result['angka']); + } + + + } + + + + function hitung_bmi($bb,$tb,$standart_bmi){ + $tb = $tb/100; + $bmi = ''; + $classs = ""; + $bmi_valuex= 0; + if(intval($bb) != 0 && intval($tb) != 0){ + $bmi = $bb / ($tb * $tb); + $bmi_valuex = number_format($bmi,2); + + if($standart_bmi === 'asia_pacific'){ + if($bmi_valuex < 18.5) + $classs = 'Underweight'; + + if($bmi_valuex >= 18.5 && $bmi_valuex < 23) + $classs = 'Normal'; + + if($bmi_valuex >= 23 && $bmi_valuex < 25) + $classs = 'Overweight'; + + if($bmi_valuex >= 25 && $bmi_valuex < 30) + $classs = 'Obese I'; + + if($bmi_valuex >= 30) + $classs = 'Obese II'; + } + + if($standart_bmi === 'who'){ + if($bmi_valuex < 18.5) + $classs = 'Underweight'; + + if($bmi_valuex >= 18.5 && $bmi_valuex < 25){ + $classs = 'Normal'; + } + + if($bmi_valuex >= 25 && $bmi_valuex < 30){ + $classs = 'Overweight'; + } + + if($bmi_valuex >= 30) + $classs = 'Obese'; + } + + if($standart_bmi === 'kemenkes'){ + if($bmi_valuex < 18.5) + $classs = 'Underweight'; + + if($bmi_valuex >= 18.5 && $bmi_valuex < 25.1) + $classs = 'Normal'; + + if($bmi_valuex >= 25.1 && $bmi_valuex < 27) + $classs = 'Overweight'; + + if($bmi_valuex >= 27) + $classs = 'Obese'; + } + } + + + + + + return array( + 'bmi' => $bmi_valuex, + 'class' => $classs + ); + } + + function keluhan($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'fisik_keluhan' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'fisik_keluhan', + 'category' => '' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']); + + } + } + + return $rst; + } + + function riwayat_penyakit($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'fisik_penyakit' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $value['segment_name'], + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$value['segment_name']); + + } + } + } + + return $rst; + } + + function penyakit_keluarga($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'fisik_penyakitkeluarga' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + $results = []; + $options = $value['options']; + foreach ($options as $ko => $vo) { + if($vo['selected'] == '1') + $results[] = $vo['label']; + } + + if(count($results) > 0){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => join(", ",$results), + 'segment' => $value['table_name'], + 'category' => $value['table_name'], + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']); + + } + } + + return $rst; + } + + + function kebiasaan_hidup($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'fisik_kebiasaanhidup' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $value['segment_name'], + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$value['segment_name']); + } + } + } + + return $rst; + } + + function fisik_konsumsiobatteratur($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'fisik_konsumsiobatteratur' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $value['table_name'], + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']); + } + } + + return $rst; + } + + + function imunasi($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'fisik_riwayatimunisasi' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $value['segment_name'], + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$value['segment_name']); + } + } + } + + return $rst; + } + + function vital_sign($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'tanda_vital' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['id_code'] == 'tanda_vital_5'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'].'_1', + 'label' => $value['label_x'], + 'note' => $value['value_x'], + 'segment' => 'tekanan_darah', + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code($value['id_code'].'_1',$value['label_x']); + $rst[] = $data_insert; + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'].'_2', + 'label' => $value['label_y'], + 'note' => $value['value_y'], + 'segment' => 'tekanan_darah', + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code($value['id_code'].'_2',$value['label_y']); + $rst[] = $data_insert; + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => 'tekanan_darah_conclusion', + 'label' => $value['standart'], + 'note' => $value['value'], + 'segment' => 'tekanan_darah', + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code('tekanan_darah_conclusion',$value['label_y']); + $rst[] = $data_insert; + } + + if($value['id_code'] == 'tanda_vital_6'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['chx_y'] == '1'?$value['label_y']:$value['label_x'], + 'note' => $value['value'], + 'segment' => 'suhu', + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code($value['id_code'],'Suhu'); + $rst[] = $data_insert; + } + + if($value['id_code'] == 'tanda_vital_1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'denyut_nadi', + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code($value['id_code'],$value['label']); + $rst[] = $data_insert; + } + + if($value['id_code'] == 'tanda_vital_2'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['chx_y'] == '1'?$value['label_y']:$value['label_x'], + 'note' => $value['value'], + 'segment' => 'ritme_denyut_nadi', + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code($value['id_code'],'Denyut Nadi'); + $rst[] = $data_insert; + } + + if($value['id_code'] == 'tanda_vital_3'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'laju_pernafasan', + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code($value['id_code'],$value['label']); + $rst[] = $data_insert; + } + + if($value['id_code'] == 'tanda_vital_4'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['chx_y'] == '1'?$value['label_y']:$value['label_x'], + 'note' => $value['value'], + 'segment' => 'pola_nafas', + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + //$this->insert_code($value['id_code'],'Pola Nafas'); + $rst[] = $data_insert; + } + + } + } + + return $rst; + } + + + function keadaan_umum($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'keadaan_umum' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx_x'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code']+'_x', + 'label' => $value['label_x'], + 'note' => $value['value'], + 'segment' => $value['table_name'], + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + } + if($value['chx_y'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'].'_y', + 'label' => $value['label_y'], + 'note' => $value['value'], + 'segment' => $value['table_name'], + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + } + + ////$this->insert_code($value['id_code'],'Keadaan Umum'); + $rst[] = $data_insert; + } + } + + return $rst; + } + + function kepala_wajah($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'kepala_wajah' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1' && $value['is_normal'] == 'N'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $value['table_name'], + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | '.$value['table_name']); + } + } + + return $rst; + } + + function mata($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'mata' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'mata', + 'category' => 'mata' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | Mata"); + + } + } + + return $rst; + } + + function lapang_pandang($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'lapang_pandang' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + $value_data = $details[0]; + + if($value_data['chx_x'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => 'lapang_pandang_x', + 'label' => $value_data['label_x'], + 'note' => $value_data['value'], + 'segment' => 'lapang_pandang', + 'category' => 'lapang_pandang' + ); + $this->insert_data_etl($data_insert,$userid); + + $rst[] = $data_insert; + } + + if($value_data['chx_y'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => 'lapang_pandang_y', + 'label' => $value_data['label_y'], + 'note' => $value_data['value'], + 'segment' => 'lapang_pandang', + 'category' => 'lapang_pandang' + ); + $this->insert_data_etl($data_insert,$userid); + + $rst[] = $data_insert; + } + //$this->insert_code('lapang_pandang_x','Lapang Pandang Tidak Normal'); + //$this->insert_code('lapang_pandang_y','Lapang Pandang Normal'); + } + + return $rst; + } + + function telinga($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'telinga' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'telinga', + 'category' => 'telinga' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | Telinga'); + } + } + + return $rst; + } + + function hidung($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'hidung' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'hidung', + 'category' => 'hidung' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | Hidung'); + } + } + + return $rst; + } + + function gigi($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'gigi' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'gigi', + 'category' => 'gigi' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | Gigi'); + + } + } + + return $rst; + } + + function mulut($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'mukosa_rongga_mulut' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + //echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + //print_r($header_details); + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + $segment = strtolower(str_replace(" ","_",$value['segment_name'])); + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$segment); + + } + } + } + + return $rst; + } + + function leher($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'leher' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'leher', + 'category' => 'leher' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | Leher'); + } + } + + return $rst; + } + + function thorax($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'thorax' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'thorax', + 'category' => 'thorax' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | Thorax'); + } + } + + return $rst; + } + + function paru($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'paru' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'paru', + 'category' => 'paru' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | Paru'); + } + } + + return $rst; + } + + function jantung($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'jantung' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + //echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + //print_r($header_details); + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + $segment = strtolower(str_replace(" ","_",str_replace("/","",$value['segment_name']))); + if($value['chx'] == '1'){ + + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$segment); + } + } + } + + return $rst; + } + + function perut($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'perut' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + //echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + //print_r($header_details); + foreach ($header_details as $k => $v) { + if($v['name'] != 'Hernia' && $v['name'] != 'Pengukuran'){ + $details = $v['details']; + foreach ($details as $key => $value) { + $segment = strtolower(str_replace(" ","_",$v['name'])); + if($value['chx'] == '1'){ + + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$segment); + } + } + + if($v['name'] == 'Hernia'){ + $details = $v['details']; + foreach ($details as $key => $value) { + if($value['id_code'] == 'perut_13'){ + if($value['chx'] == '1'){ + $segment = strtolower(str_replace(" ","_",$v['name'])); + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | Hernia '.$segment); + } + + if($value['id_code'] == 'perut_14'){ + $segment = strtolower(str_replace(" ","_",$v['name'])); + if($value['chx'] == '1'){ + $child_details = $value['details']; + foreach ($child_details as $kx => $vx) { + if($vx['id_code'] == 'perut_14_1'){ + if($vx['chx_value'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $vx['id_code'], + 'label' => $vx['label'], + 'note' => '', + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | Hernia '.$segment); + } + + if($vx['id_code'] != 'perut_14_1'){ + if($vx['chx_a_value'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $vx['id_code'].'_'.$vx['chx_a_label'], + 'label' => $vx['label'], + 'note' => $vx['chx_a_label'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + + if($vx['chx_b_value'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $vx['id_code'].'_'.$vx['chx_b_label'], + 'label' => $vx['label'], + 'note' => $vx['chx_b_label'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($vx['id_code'].'_'.$vx['chx_a_label'],$value['label'].' | Hernia '.$segment); + //$this->insert_code($vx['id_code'].'_'.$vx['chx_b_label'],$value['label'].' | Hernia '.$segment); + } + + } + } + //$this->insert_code($value['id_code'],$value['label']); + } + + + } + } + + if($v['name'] == 'Hernia'){ + $details = $v['details']; + } + + } + } + + return $rst; + } + + function sistem_integumen($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'sistem_integumen' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + //echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + //print_r($header_details); + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + $segment = strtolower(str_replace(" ","_",$value['segment_name'])); + if($value['chx'] == '1'){ + + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$segment); + } + } + } + + return $rst; + } + + function genitourinaria($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'genitourinaria' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => 'genitourinaria', + 'category' => 'genitourinaria' + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' Genitourinaria'); + } + } + + return $rst; + } + + function anggota_gerak($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'anggota_gerak' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + //echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + //print_r($header_details); + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $segment = strtolower(str_replace(" ","_",str_replace("/","",$value['segment_name']))); + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$segment); + } + } + } + + return $rst; + } + + function sistem_persyarafan($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'sistem_persyarafan' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + //echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + //print_r($header_details); + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $segment = strtolower(str_replace(" ","_",str_replace("&","",$value['segment_name']))); + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$segment); + } + } + } + + return $rst; + } + + function smell_test($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'smell_test' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + //echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + //print_r($header_details); + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $segment = strtolower(str_replace(" ","_",$value['segment_name'])); + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$segment); + } + } + } + + return $rst; + } + + function low_back_pain_screening_test($id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + FisikTemplateTableName = 'low_back_pain_screening_test' + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id)); + //echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $header_details = $valdata['details']; + //print_r($header_details); + foreach ($header_details as $k => $v) { + $details = $v['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $segment = strtolower(str_replace(" ","_",$value['segment_name'])); + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => $value['value'], + 'segment' => $segment, + 'category' => $value['table_name'] + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label']." | ".$segment); + } + } + } + + return $rst; + } + + function k3($type,$id,$userid){ + $rst = []; + $sql = "SELECT * + FROM fisik_template + JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND + So_ResultEntryFisikUmumSo_ResultEntryID = ? + JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID + WHERE + FisikTemplateIsActive = 'Y' AND + `FisikTemplateType` = 'k3' AND + FisikTemplateTableName = ? + ORDER BY FisikTemplateCode ASC + LIMIT 1 + "; + $qry = $this->db_smartone->query($sql, array($id,$type)); + // echo $this->db_smartone->last_query(); + $datas = $qry->result_array(); + if($datas && count($datas) > 0){ + $order_header_id = $datas[0]['So_ResultEntryT_OrderHeaderID']; + $valdata = json_decode($datas[0]['So_ResultEntryFisikUmumDetails'], true); + $details = $valdata['details']; + foreach ($details as $key => $value) { + if($value['chx'] == '1'){ + $data_insert = array( + 'order_id' => $order_header_id, + 'code' => $value['id_code'], + 'label' => $value['label'], + 'note' => '', + 'segment' => $type, + 'category' => $type + ); + $this->insert_data_etl($data_insert,$userid); + $rst[] = $data_insert; + } + //$this->insert_code($value['id_code'],$value['label'].' | '.$type); + } + } + + return $rst; + } + + function loop_k3($id,$userid){ + $rspn = []; + $arr = ['faktor_fisik','faktor_kimia','faktor_biologi','faktor_ergonomi','faktor_psikologi']; + foreach ($arr as $key => $value) { + $rtn = $this->k3($value,$id,$userid); + if(count($rtn) > 0) + $rspn[] = $rtn; + } + return $rspn; + } + + function generate_summaries($orderID,$soReID,$userID,$debugID=0){ + $sql = "UPDATE t_kelainan_fisik SET + T_KelainanFiskIsActive = 'N', + T_KelainanFiskDeletedUserID = ? , + T_KelainanFiskDeleted = NOW() + WHERE + T_KelainanFiskT_OrderHeaderID = ? AND + T_KelainanFiskIsActive = 'Y'"; + $query = $this->db_smartone->query($sql,[ + $userID, + $orderID + ]); + $kelainanrst = []; + $sql = "SELECT * + FROM mcu_fisiksummary + JOIN mcu_kelainan ON Mcu_kelainanID = Mcu_FisikSummaryMcu_KelainanID + WHERE Mcu_FisikSummaryIsActive = 'Y'"; + $query = $this->db_smartone->query($sql); + $rumus_summaries = $query->result_array(); + //print_r($rumus_summaries); + + foreach ($rumus_summaries as $key => $value) { + //echo $value['Mcu_KelainanName']; + $results = []; + $sql = "SELECT * + FROM mcu_fisiksummarydetail + WHERE + Mcu_FisikSummaryDetailMcu_FisikSummaryID = ? AND + Mcu_FisikSummaryDetailIsActive = 'Y'"; + + $query = $this->db_smartone->query($sql,[$value['Mcu_FisikSummaryID']]); + $details = $query->result_array(); + foreach ($details as $k => $v) { + if($v['Mcu_FisikSummaryDetailType'] == 'VK'){ + $sql = "SELECT * + FROM mcu_fisikvalue + WHERE + Mcu_FisikValueT_OrderHeaderID = ? AND + Mcu_FisikValueIsActive = 'Y' AND + Mcu_FisikValueCode = ? AND + Mcu_FisikValueNote = ?"; + $query = $this->db_smartone->query($sql,[$orderID,$v['Mcu_FisikSummaryDetailCode'],$value['Mcu_KelainanName']]); + /*if($value['Mcu_FisikSummaryID'] == 2){ + echo $this->db_smartone->last_query(); + }*/ + $exist_rows = $query->result_array(); + $return_x = false; + if(count($exist_rows) > 0){ + $return_x = true; + } + $results[] = $return_x; + } + + if($v['Mcu_FisikSummaryDetailType'] == 'V'){ + $sql = "SELECT * + FROM mcu_fisikvalue + JOIN mcu_fisiksummarydetail + ON Mcu_FisikSummaryDetailIsActive = 'Y' + AND Mcu_FisikSummaryDetailCode = Mcu_FisikValueCode + AND Mcu_FisikValueCode = ? + AND Mcu_FisikSummaryDetailType = 'V' + JOIN mcu_fisiksummary + ON Mcu_FisikSummaryDetailMcu_FisikSummaryID = Mcu_FisikSummaryID + AND Mcu_FisikSummaryMcu_KelainanID = ? + WHERE Mcu_FisikValueT_OrderHeaderID = ? + AND Mcu_FisikValueIsActive = 'Y' + AND Mcu_FisikSummaryDetailValue REGEXP CONCAT('(^|, )', TRIM(Mcu_FisikValueNote), '(,|$)')"; + $query = $this->db_smartone->query($sql,[$v['Mcu_FisikSummaryDetailCode'],$value['Mcu_KelainanID'],$orderID]); + if($value['Mcu_FisikSummaryID'] == $debugID){ + echo $this->db_smartone->last_query(); + } + $exist_rows = $query->result_array(); + $return_x = false; + if(count($exist_rows) > 0){ + $return_x = true; + } + $results[] = $return_x; + } + + if($v['Mcu_FisikSummaryDetailType'] == 'C'){ + $sql = "SELECT * + FROM mcu_fisikvalue + WHERE + Mcu_FisikValueT_OrderHeaderID = ? AND + Mcu_FisikValueIsActive = 'Y' AND + Mcu_FisikValueCode = ?"; + $query = $this->db_smartone->query($sql,[$orderID,$v['Mcu_FisikSummaryDetailCode']]); + if($value['Mcu_FisikSummaryID'] == $debugID){ + echo $this->db_smartone->last_query(); + } + + $exist_rows = $query->result_array(); + $return_x = false; + if(count($exist_rows) > 0){ + $return_x = true; + } + $results[] = $return_x; + } + } + //if($value['Mcu_FisikSummaryID'] == 2) + //print_r($results); + + $is_kelainan = false; + if($value['Mcu_FisikSummaryType'] == "AND"){ + if(!in_array(false,$results)) + $is_kelainan = true; + + //if($value['Mcu_FisikSummaryID'] == $debugID){ + // echo "AND"; + // print_r($results); +//} + + } + if($value['Mcu_FisikSummaryType'] == "OR"){ + if(in_array(true,$results)) + $is_kelainan = true; + + //if($value['Mcu_FisikSummaryID'] == $debugID){ + // echo "OR"; + // print_r($results); + //} + } + + //if($value['Mcu_FisikSummaryMcu_KelainanID'] == 27) + // echo $this->db_smartone->last_query(); + if($is_kelainan){ + + //if($value['Mcu_FisikSummaryID'] == 2){ + // echo "IHIR"; + //} + $sql = "INSERT INTO t_kelainan_fisik( + T_KelainanFiskSo_ResultEntryID, + T_KelainanFiskT_OrderHeaderID, + T_KelainanFiskMcu_KelainanID, + T_KelainanFiskMcu_FisikSummaryID, + T_KelainanFiskCreatedUserID, + T_KelainanFiskCreated + ) VALUES(?,?,?,?,?,NOW())"; + $query = $this->db_smartone->query($sql,[ + $soReID, + $orderID, + $value['Mcu_FisikSummaryMcu_KelainanID'], + $value['Mcu_FisikSummaryID'], + $userID + ]); + $kelainanrst[] = array( + 'id' => $value['Mcu_FisikSummaryMcu_KelainanID'], + 'name' => $value['Mcu_KelainanName'] + ); + } + + } + } + + function translate_word($word,$langid=1){ + if($langid == 1){ + return $word; + } + else{ + $sql = "SELECT * FROM translate_word WHERE Translate_WordIsActive = 'Y' AND Translate_WordFrom = '{$word}'"; + //echo $sql; + $qry = $this->db_smartone->query($sql); + if (! $qry) { + return $word; + } + + $rows = $qry->result_array(); + if(count($rows) > 0){ + return $rows[0]["Translate_WordTo"]; + }else{ + return $word; + } + } + } + + function translate_multiline_text($text, $langid = 1) { + // Split the text into lines + $lines = explode("\n", $text); + + // Translate each line + $translated_lines = array_map(function($line) use ($langid) { + // Remove the leading "- " and translate the rest + $trimmed_line = ltrim($line, "- "); + return "- " . $this->translate_sentence($trimmed_line, $langid); + }, $lines); + + // Join the translated lines back into a multiline string + return implode("\n", $translated_lines); + } + + function translate_sentence($sentence, $langid = 1) { + // Split the sentence into words + $words = preg_split('/[\s-]+/', $sentence); + + // Translate each word + $translated_words = array_map(function($word) use ($langid) { + return $this->translate_word($word, $langid); + }, $words); + + // Join the translated words back into a sentence + return implode(' ', $translated_words); + } + +} diff --git a/application/libraries/Excel.php b/application/libraries/Excel.php new file mode 100644 index 00000000..a2ff4d7d --- /dev/null +++ b/application/libraries/Excel.php @@ -0,0 +1,14 @@ + + diff --git a/application/libraries/Generateqrreport.php b/application/libraries/Generateqrreport.php new file mode 100644 index 00000000..fa64d2b3 --- /dev/null +++ b/application/libraries/Generateqrreport.php @@ -0,0 +1,638 @@ +=3)', + `QR_PrintOutRetryCount` int(11) NOT NULL DEFAULT 0 + COMMENT 'Berapa kali sudah dicoba upload, maksimal 3', + `QR_PrintOutLastRetryAt` datetime DEFAULT NULL + COMMENT 'Waktu percobaan upload terakhir yang gagal', + `QR_PrintOutUploadedAt` datetime DEFAULT NULL + COMMENT 'Waktu upload PDF ke dedicated server berhasil', + `QR_PrintOutCreatedAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP + COMMENT 'Waktu token QR dibuat', + `QR_PrintOutCreatedByUserID` int(11) NOT NULL DEFAULT 0 + COMMENT 'UserID yang mencetak laporan', + `QR_PrintOutIsActive` tinyint(1) NOT NULL DEFAULT 1 + COMMENT '1=aktif, 0=dinonaktifkan (mis. hasil direvisi)', + PRIMARY KEY (`QR_PrintOutID`), + UNIQUE KEY `uq_qr_uuid` (`QR_PrintOutUUID`), + KEY `idx_order_header` (`QR_PrintOutT_OrderHeaderID`), + KEY `idx_upload_status` (`QR_PrintOutUploadStatus`), + KEY `idx_retry` (`QR_PrintOutUploadStatus`, `QR_PrintOutRetryCount`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + COMMENT='Token QR Code untuk verifikasi keaslian laporan hasil laboratorium'; + */ +/** + * Generateqrreport Library + * + * Library untuk generate QR Code pada laporan hasil laboratorium. + * QR Code berisi URL langsung ke file PDF di dedicated server. + * Saat QR di-scan, browser langsung membuka file PDF tersebut. + * + * Arsitektur: + * + * ┌─ PHP App (ini) ──────────────────────────────────────────────┐ + * │ 1. saveQRPrintout(verifyBaseURL='https://ds.com/files') │ + * │ → UUID + verifyURL = https://ds.com/files/{uuid}.pdf │ + * │ verifyURL = URL final PDF = yang di-encode ke QR Code │ + * │ 2. generateQRImageBase64(verifyURL) → embed QR ke PDF cetak │ + * │ 3. saveTempPDF() → simpan PDF sementara di /tmp/ │ + * └──────────────────────────────────────────────────────────────┘ + * │ + * ▼ + * ┌─ Golang Upload Tool ─────────────────────────────────────────┐ + * │ - Poll PHP API: getPendingUploads() │ + * │ - Ambil TempFilePath dari row │ + * │ - Upload PDF ke dedicated server pada path sesuai verifyURL │ + * │ - Berhasil → callback confirmUpload($uuid) │ + * │ - Gagal → callback incrementRetry($uuid) │ + * └──────────────────────────────────────────────────────────────┘ + * + * ┌─ Dedicated Server ───────────────────────────────────────────┐ + * │ - Serve file PDF statis │ + * │ - URL: https://ds.com/files/{uuid}.pdf │ + * │ - Saat QR di-scan → browser langsung buka PDF ini │ + * └──────────────────────────────────────────────────────────────┘ + * + * Tabel yang digunakan: qr_printout + * (lihat: sql/qr_printout_updated.sql untuk DDL lengkap) + */ +class Generateqrreport +{ + /** @var CI_DB_driver */ + protected $db_smartone; + + /** @var CI_DB_driver */ + protected $db_onedev; + + function __construct() + { + $CI = & get_instance(); + $this->db_smartone = $CI->load->database("default", true); + $this->db_onedev = $CI->load->database("default", true); + + $this->_loadQRLib(); + } + + // ========================================================================= + // PRIVATE HELPERS + // ========================================================================= + + /** + * Load phpqrcode library jika belum di-include. + */ + private function _loadQRLib() + { + if (!class_exists('QRcode', false)) { + $libPath = APPPATH . 'libraries/qrcode/'; + if (!defined('QR_CACHEABLE')) + define('QR_CACHEABLE', false); + if (!defined('QR_CACHE_DIR')) + define('QR_CACHE_DIR', APPPATH . 'cache/'); + if (!defined('QR_LOG_DIR')) + define('QR_LOG_DIR', APPPATH . 'logs/'); + if (!defined('QR_FIND_BEST_MASK')) + define('QR_FIND_BEST_MASK', true); + if (!defined('QR_FIND_FROM_RANDOM')) + define('QR_FIND_FROM_RANDOM', false); + if (!defined('QR_PNG_MAXIMUM_SIZE')) + define('QR_PNG_MAXIMUM_SIZE', 1024); + + include_once $libPath . 'phpqrcode.php'; + } + } + + /** + * Generate UUID v4. + * + * @param bool $withHyphens true → 36 char 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' + * false → 32 char hex tanpa tanda hubung + * @return string + */ + private function _generateUUID($withHyphens = true) + { + $data = random_bytes(16); + $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // version 4 + $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // variant bits + + $uuid = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); + return $withHyphens ? $uuid : str_replace('-', '', $uuid); + } + + /** + * Normalisasi UUID: konversi 32-char (tanpa hyphen) ke format 36-char standar. + * + * @param string $uuid + * @return string lowercase 36-char UUID + */ + private function _normalizeUUID($uuid) + { + $uuid = trim($uuid); + if (strlen($uuid) === 32 && strpos($uuid, '-') === false) { + $uuid = substr($uuid, 0, 8) . '-' + . substr($uuid, 8, 4) . '-' + . substr($uuid, 12, 4) . '-' + . substr($uuid, 16, 4) . '-' + . substr($uuid, 20); + } + return strtolower($uuid); + } + + /** + * Validasi format UUID v4 (8-4-4-4-12). + * + * @param string $uuid + * @return bool + */ + private function _validateUUIDFormat($uuid) + { + return (bool)preg_match( + '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/', + strtolower($uuid) + ); + } + + // ========================================================================= + // PUBLIC METHODS — QR TOKEN + // ========================================================================= + + /** + * Buat record QR baru di tabel qr_printout. + * + * verifyURL = URL LANGSUNG ke file PDF di dedicated server. + * URL ini yang di-encode ke gambar QR Code. + * Golang tool akan upload PDF ke path/URL ini. + * + * Contoh: + * verifyBaseURL = 'https://files.lab.rs.com/reports' + * verifyURL = 'https://files.lab.rs.com/reports/{uuid}.pdf' + * + * @param array $params Wajib: + * - orderHeaderID (int) FK ke t_orderheader + * - groupResultName (string) Label group, mis: 'HEMATOLOGI' + * - verifyBaseURL (string) Base URL folder PDF di dedicated server, + * contoh: 'https://files.lab.rs.com/reports' + * Hasilnya: {verifyBaseURL}/{uuid}.pdf + * Opsional: + * - groupResultID (int) default 0 + * - testID (int) default 0 + * - createdByUserID (int) default 0 + * @return array [ + * 'success' => bool, + * 'uuid' => string|null, // 36-char dengan hyphen + * 'uuid_short' => string|null, // 32-char tanpa hyphen + * 'verifyURL' => string|null, // URL PDF final = yang di-encode ke QR Code + * 'qr_printout_id' => int|null, + * 'message' => string + * ] + */ + public function saveQRPrintout(array $params) + { + $required = ['orderHeaderID', 'groupResultName', 'verifyBaseURL', 'QR_PrintOutReportURL']; + foreach ($required as $field) { + if (empty($params[$field])) { + return [ + 'success' => false, + 'uuid' => null, + 'uuid_short' => null, + 'verifyURL' => null, + 'qr_printout_id' => null, + 'message' => "Parameter '{$field}' wajib diisi.", + ]; + } + } + + $uuid = $this->_generateUUID(true); + $uuidShort = str_replace('-', '', $uuid); + + // verifyURL = URL langsung ke PDF: {base}/{uuid}.pdf + // Golang akan upload PDF ke path ini di dedicated server + $verifyURL = rtrim($params['verifyBaseURL'], '/') . '/' . str_replace('-', '', $uuid) . '.pdf'; + + $data = [ + 'QR_PrintOutT_OrderHeaderID' => (int)$params['orderHeaderID'], + 'QR_PrintOutGroup_ResultID' => (int)($params['groupResultID'] ?? 0), + 'QR_PrintOutT_TestID' => (int)($params['testID'] ?? 0), + 'QR_PrintOutGroup_ResultName' => $params['groupResultName'], + 'QR_PrintOutUUID' => $uuid, + 'QR_PrintOutVerifyURL' => $verifyURL, // URL final PDF = yang di-encode ke QR Code + 'QR_PrintOutReportURL' => $params['QR_PrintOutReportURL'], // URL sumber PDF di PHP server (Golang fetch dari sini) + 'QR_PrintOutTempFilePath' => '', + 'QR_PrintOutUploadStatus' => 'pending', + 'QR_PrintOutRetryCount' => 0, + 'QR_PrintOutLastRetryAt' => null, + 'QR_PrintOutUploadedAt' => null, + 'QR_PrintOutCreatedAt' => date('Y-m-d H:i:s'), + 'QR_PrintOutCreatedByUserID' => (int)($params['createdByUserID'] ?? 0), + 'QR_PrintOutIsActive' => 1, + ]; + + $this->db_smartone->insert('qr_printout', $data); + + if ($this->db_smartone->affected_rows() === 0) { + return [ + 'success' => false, + 'uuid' => null, + 'uuid_short' => null, + 'verifyURL' => null, + 'qr_printout_id' => null, + 'message' => 'Gagal menyimpan data QR Printout ke database.', + ]; + } + + return [ + 'success' => true, + 'uuid' => $uuid, + 'uuid_short' => $uuidShort, + 'verifyURL' => $verifyURL, // ini yang di-encode ke gambar QR Code + 'qr_printout_id' => $this->db_smartone->insert_id(), + 'message' => 'OK', + ]; + } + + /** + * Nonaktifkan QR Code (misal karena hasil direvisi dan QR lama tidak boleh diakses). + * + * @param string $uuid + * @return bool + */ + public function deactivateQR($uuid) + { + $uuid = $this->_normalizeUUID($uuid); + $this->db_smartone->where('QR_PrintOutUUID', $uuid) + ->update('qr_printout', ['QR_PrintOutIsActive' => 0]); + return $this->db_smartone->affected_rows() > 0; + } + + // ========================================================================= + // PUBLIC METHODS — QR IMAGE + // ========================================================================= + + /** + * Generate QR Code sebagai Base64 PNG string. + * Hasil bisa langsung di-embed ke HTML/PDF: tags if present
+ $response = strip_tags($response);
+
+ $responseData = json_decode($response, true);
+ if (!$responseData || !isset($responseData['message']['content'])) {
+ return ["status"=>"ERR", "message"=> "raw : $response"];
+ }
+
+ // Parse content into JSON object
+ $content = $responseData["message"]["content"];
+ // echo "content:\n";
+ // echo $content . "\n";
+ // echo "\n";
+ $parsedData = [];
+ $lines = explode("\n", $content);
+ foreach ($lines as $line) {
+ $parts = explode(":", $line, 2);
+ if (count($parts) == 2) {
+ $key = trim(str_replace("*","",$parts[0]));
+ $key = strtolower($key);
+ $key = str_replace(" ","_",$key);
+ $value = trim(str_replace("*","",$parts[1]));
+
+ if (strpos($key, "/")) {
+ $a_key = explode("/", $key);
+ $a_val = explode(",", $value);
+ if (strpos($value, "/")) {
+ $a_val = explode("/", $value);
+ }
+ foreach($a_key as $a_idx => $sub_key) {
+ $sub_val = $a_val[$a_idx];
+ $parsedData[trim($sub_key)] = trim($sub_val);
+ }
+ } else {
+ $parsedData[$key] = $value;
+ }
+ }
+ }
+ $info["total_duration"] = $responseData["total_duration"];
+ $info["prompt_eval_duration"] = $responseData["prompt_eval_duration"];
+ $info["eval_duration"] = $responseData["eval_duration"];
+ $info["model"] = $responseData["model"];
+ return ["status"=>"OK", "data" => $parsedData, "info"=> $info];
+ }
+}
diff --git a/application/libraries/Ocr_oroute.php b/application/libraries/Ocr_oroute.php
new file mode 100644
index 00000000..89cef430
--- /dev/null
+++ b/application/libraries/Ocr_oroute.php
@@ -0,0 +1,119 @@
+ "ERR", "message" => "Error: File not found."];
+ }
+
+ // Load image and convert to black and white
+ $image = imagecreatefromstring(file_get_contents($imagePath));
+ // imagefilter($image, IMG_FILTER_GRAYSCALE);
+
+ // Get original dimensions and resize
+ // $originalWidth = imagesx($image);
+ // $originalHeight = imagesy($image);
+ // $newWidth = intval(640);
+ // $newHeight = intval($originalHeight * ($newWidth / $originalWidth));
+ // $resizedImage = imagecreatetruecolor($newWidth, $newHeight);
+ // imagecopyresampled($resizedImage, $image, 0, 0, 0, 0, $newWidth, $newHeight, $originalWidth, $originalHeight);
+
+ // Convert image to base64
+ ob_start();
+ // imagejpeg($resizedImage);
+ imagejpeg($image);
+ $imageData = ob_get_clean();
+ $imgStr = base64_encode($imageData);
+ $imgStrNew = "data:image/jpeg;base64," . $imgStr;
+
+ // Prepare request payload
+ $payload = json_encode([
+ "model" => $this->modelName,
+ "messages" => [[
+ "role" => "user",
+ "content" => [
+ [
+ "type" => "text",
+ "text" => "Extract all text from the given image. Return result only, in the pattern label:value as it is, without translation."
+ ],
+ [
+ "type" => "image_url",
+ "image_url" => [
+ "url" => $imgStrNew
+ ],
+ ]
+ ],
+ ]],
+ "options" => ["temperature" => $this->temperature],
+ "stream" => false
+ ]);
+
+ // Initialize cURL
+ $ch = curl_init(self::API_URL);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ "Content-Type: application/json",
+ "Authorization: Bearer " . self::API_KEY
+ ]);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
+
+ // Execute request
+ $response = curl_exec($ch);
+ if (curl_errno($ch)) {
+ $error = curl_error($ch);
+ curl_close($ch);
+ return ["status" => "ERR", "message" => "Error CURL ke API " . curl_error($ch)];
+ }
+ curl_close($ch);
+
+ $response = strip_tags($response);
+ $responseData = json_decode($response, true);
+ $content = $responseData['choices'][0]['message']['content'];
+
+ if (is_null($responseData) || !isset($content)) {
+ return ["status" => "ERR", "message" => "raw : $response"];
+ }
+
+ $parsedData = [];
+ $lines = explode("\n", $content);
+ foreach ($lines as $line) {
+ $parts = explode(":", $line, 2);
+ if (count($parts) == 2) {
+ $key = trim(str_replace("*", "", $parts[0]));
+ $key = strtolower($key);
+ $key = str_replace(" ", "_", $key);
+ $value = trim(str_replace("*", "", $parts[1]));
+
+ if (strpos($key, "/")) {
+ $a_key = explode("/", $key);
+ $a_val = explode(",", $value);
+ if (strpos($value, "/")) {
+ $a_val = explode("/", $value);
+ }
+ foreach ($a_key as $a_idx => $sub_key) {
+ $sub_val = $a_val[$a_idx];
+ $parsedData[trim($sub_key)] = trim($sub_val);
+ }
+ } else {
+ $parsedData[$key] = $value;
+ }
+ }
+ }
+ $info["prompt_tokens"] = $responseData["usage"]["prompt_tokens"];
+ $info["completion_tokens"] = $responseData["usage"]["completion_tokens"];
+ $info["total_tokens"] = $responseData["usage"]["total_tokens"];
+ $info["estimated_cost"] = $responseData["usage"]["estimated_cost"];
+ $info["model"] = $this->modelName;
+ $info["temperature"] = $this->temperature;
+ return ["status" => "OK", "data" => $parsedData, "info" => $info];
+ }
+}
diff --git a/application/libraries/Report.php b/application/libraries/Report.php
new file mode 100644
index 00000000..77e490ca
--- /dev/null
+++ b/application/libraries/Report.php
@@ -0,0 +1,319 @@
+db = $CI->load->database("onedev", true);
+ $this->db_log = $CI->load->database("one_lab_log", true);
+
+ $this->db->trans_begin();
+
+ $sql = "SELECT NonlabTemplateID as template_id,
+ NonlabTemplateName as template_name,
+ T_SamplingSoT_OrderHeaderID as order_header_id,
+ T_OrderDetailID as order_detail_id
+ FROM t_samplingso
+ JOIN t_orderdetail ON T_SamplingSoT_OrderHeaderID = T_OrderDetailT_OrderHeaderID AND T_SamplingSoT_TestID = T_OrderDetailT_TestID AND T_OrderDetailIsActive = 'Y'
+ JOIN t_test ON T_SamplingSoT_TestID = T_TestID
+ JOIN nat_test ON Nat_TestID = T_TestNat_TestID
+ JOIN nonlab_template_mapping ON NonlabTemplateMappingNat_TestID = Nat_TestID AND
+ NonlabTemplateMappingIsActive = 'Y'
+ JOIN nonlab_template ON NonlabTemplateMappingNonlabTemplateID = NonlabTemplateID AND NonlabTemplateIsActive = 'Y'
+ LEFT JOIN so_resultentry ON So_ResultEntryT_OrderDetailID = T_OrderDetailID AND
+ So_ResultEntryT_OrderHeaderID = T_OrderDetailT_OrderHeaderID AND
+ So_ResultEntryIsActive = 'Y'
+ WHERE
+ T_SamplingSoID = ? AND
+ T_SamplingSoIsActive = 'Y' AND
+ So_ResultEntryID IS NULL
+ GROUP BY NonlabTemplateID
+ LIMIT 1";
+ $qry = $this->db->query($sql, array($T_SamplingSOID));
+ //echo $this->db->last_query();
+ if (!$qry) {
+ $dt_log = ['data' => ['id' => $T_SamplingSOID],'error' => $this->db->error()];
+ $prm_log = ['SELECT_NONLAB_TEMPLATE', 'nonlabtemplate/generate'];
+ $xsql = $this->db->last_query();
+ $log_error = $this->insert_log_error($xsql, $prm_log,$dt_log);
+ $this->db->trans_rollback();
+ return array(false, print_r($this->db->error(), true));
+ }
+
+ $row_arr = $qry->row_array();
+ if ($row_arr) {
+ //print_r($row_arr);
+ $template_name = $row_arr['template_name'];
+ if($row_arr['template_name'] == 'Fisik Umum'){
+ $sql = "SELECT FisikTemplateType as xtype
+ FROM fisik_template
+ JOIN t_orderheader ON T_OrderHeaderID = {$row_arr['order_header_id']}
+ JOIN mgm_mcutemplate ON Mgm_McuTemplateMgm_McuID = T_OrderHeaderMgm_McuID
+ JOIN fisik_template_mapping ON Mgm_McuTemplateFisikTemplateMappingID = FisikTemplateMappingID
+ JOIN fisik_template_mapping_detail ON FisikTemplateMappingDetailFisikTemplateMappingID = FisikTemplateMappingID AND
+ FisikTemplateMappingDetailFisikTemplateID = FisikTemplateID AND
+ FisikTemplateMappingDetailIsActive = 'Y'
+ WHERE
+ FisikTemplateIsActive = 'Y'
+ GROUP BY FisikTemplateType";
+ $qry = $this->db->query($sql);
+ //echo $this->db->last_query();
+ if (!$qry) {
+ $dt_log = ['data' => ['id' => $T_SamplingSOID],'error' => $this->db->error()];
+ $prm_log = ['SELECT_FISIK_TEMPLATE', 'nonlabtemplate/generate'];
+ $xsql = $this->db->last_query();
+ $log_error = $this->insert_log_error($xsql, $prm_log,$dt_log);
+ $this->db->trans_rollback();
+ return array(false, print_r($this->db->error(), true));
+ }
+ $arr_types = $qry->result_array();
+ $xtypes = [];
+ foreach ($arr_types as $key => $value) {
+ $xtypes[] = $value['xtype'];
+ }
+
+ $template_name = "Fisik Umum";
+ if(in_array("K3", $xtypes)){
+ $template_name = "Fisik Umum K3";
+ }
+//echo $template_name;
+ }
+
+ $sql = "INSERT INTO so_resultentry(
+ So_ResultEntryT_OrderHeaderID,
+ So_ResultEntryT_OrderDetailID,
+ So_ResultEntryNonlab_TemplateID,
+ So_ResultEntryNonlab_TemplateName,
+ So_ResultEntryCreated
+ )
+ VALUES(?,?,?,?,NOW())";
+ $qry = $this->db->query($sql, array(
+ $row_arr['order_header_id'],
+ $row_arr['order_detail_id'],
+ $row_arr['template_id'],
+ $template_name
+ ));
+ if (!$qry) {
+ $dt_log = ['data' => ['id' => $T_SamplingSOID],'error' => $this->db->error()];
+ $prm_log = ['INSERT_SO_RESULTENTRY', 'nonlabtemplate/generate'];
+ $xsql = $this->db->last_query();
+ $log_error = $this->insert_log_error($xsql, $prm_log,$dt_log);
+ $this->db->trans_rollback();
+ return array(false, print_r($this->db->error(), true));
+ }
+ $soresultentryid = $this->db->insert_id();
+
+ $sql = "SELECT * FROM t_orderheaderlang
+ WHERE
+ T_OrderHeaderLangT_OrderHeaderID = ? AND T_OrderHeaderLangIsActive = 'Y'";
+ $qry = $this->db->query($sql, array(
+ $row_arr['order_header_id']
+ ));
+ if (!$qry) {
+ $dt_log = ['data' => ['id' => $T_SamplingSOID],'error' => $this->db->error()];
+ $prm_log = ['SELECT_ORDER_HEADER_LANG', 'nonlabtemplate/generate'];
+ $xsql = $this->db->last_query();
+ $log_error = $this->insert_log_error($xsql, $prm_log,$dt_log);
+ $this->db->trans_rollback();
+ return array(false, print_r($this->db->error(), true));
+ }
+
+ $order_langs = $qry->result_array();
+ //print_r($order_langs);
+
+ foreach ($order_langs as $k_lang => $val_lang) {
+ $sql = "SELECT *
+ FROM nonlab_template_detail
+ JOIN t_orderheader ON T_OrderHeaderID = ?
+ JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
+ JOIN m_sex ON M_SexID = M_PatientM_SexID AND M_SexIsActive = 'Y' AND
+ ( NonlabTemplateDetailGender = 'all' OR NonlabTemplateDetailGender = M_SexNameLang)
+ WHERE
+ NonlabTemplateDetailNonlabTemplateID = ? AND NonlabTemplateDetailIsActive = 'Y' AND NonlabTemplateDetaiM_LangID = ? ";
+ $qry = $this->db->query($sql, array(
+ $row_arr['order_header_id'],
+ $row_arr['template_id'],
+ $val_lang['T_OrderHeaderLangM_LangID']
+ ));
+ //echo $this->db->last_query();
+ if (!$qry) {
+ $dt_log = ['data' => ['id' => $T_SamplingSOID],'error' => $this->db->error()];
+ $prm_log = ['SELECT_NONLAB_TEMPLATE_DETAIL', 'nonlabtemplate/generate'];
+ $xsql = $this->db->last_query();
+ $log_error = $this->insert_log_error($xsql, $prm_log,$dt_log);
+ $this->db->trans_rollback();
+ return array(false, print_r($this->db->error(), true));
+ }
+
+ $rows_result = $qry->result_array();
+ if($rows_result && count($rows_result) > 0){
+ foreach ($rows_result as $key => $value) {
+ if(intval($val_lang['T_OrderHeaderLangM_LangID']) == 1){
+ $sql = "INSERT INTO so_resultentrydetail (
+ So_ResultEntryDetailSo_ResultEntryID,
+ So_ResultEntryDetailNonlab_TemplateDetailID,
+ So_ResultEntryDetailNonlab_TemplateDetailName,
+ So_ResultEntryDetailCreated
+ )
+ VALUES(?,?,?,NOW())";
+ $qry = $this->db->query($sql, array(
+ $soresultentryid,
+ $value['NonlabTemplateDetailID'],
+ $value['NonlabTemplateDetailName']
+ ));
+ if (!$qry) {
+ $dt_log = ['data' => ['id' => $T_SamplingSOID],'error' => $this->db->error()];
+ $prm_log = ['INSERT_SO_RESULTENTRY_DETAIL', 'nonlabtemplate/generate'];
+ $xsql = $this->db->last_query();
+ $log_error = $this->insert_log_error($xsql, $prm_log,$dt_log);
+ $this->db->trans_rollback();
+ return array(false, print_r($this->db->error(), true));
+ }
+ //echo $this->db->last_query();
+ }
+ }
+ }
+
+
+ }
+
+
+ $this->db->trans_commit();
+
+
+
+ $sql = "SELECT *
+ FROM so_resultentry
+ WHERE
+ So_ResultEntryID = ? ";
+ $qry = $this->db->query($sql, array(
+ $soresultentryid
+ ));
+
+ if (!$qry) {
+ return array(false, print_r($this->db->error(), true));
+ }
+
+ $rows_return = $qry->row_array();
+
+ return $rows_return;
+ } else {
+ return false;
+ }
+ }
+
+ function get_report_by_code($report_code, $params){
+ $sql = "SELECT *
+ FROM print_transaction
+ WHERE
+ Print_TransactionCode = ? ";
+ $qry = $this->db->query($sql, array(
+ $report_code
+ ));
+
+ if (!$qry) {
+ return array(false, print_r($this->db->error(), true));
+ }
+
+ $rows_return = $qry->row_array();
+
+ return $rows_return;
+ }
+
+ function get_report_url_by_code($report_code, $params = array()){
+ $CI = &get_instance();
+ $this->db = $CI->load->database("onedev", true);
+
+ // Get report data by code
+ $report_data = $this->get_report_by_code($report_code, $params);
+
+ if (!$report_data || empty($report_data)) {
+ return array(false, "Report code not found: " . $report_code);
+ }
+
+ // Get URL template
+ $url_template = $report_data['Print_TransactionUrl'];
+
+ if (empty($url_template)) {
+ return array(false, "URL template is empty for report code: " . $report_code);
+ }
+
+ // Replace placeholders with actual parameter values
+ $final_url = $url_template;
+
+ foreach ($params as $param_key => $param_value) {
+ // Determine if value should be quoted (string) or not (numeric)
+ $replacement_value = is_numeric($param_value) ? $param_value : "'" . $param_value . "'";
+
+ // Replace placeholder in URL
+ $final_url = str_replace($param_key, $replacement_value, $final_url);
+ }
+
+ return array(true, $final_url);
+ }
+ /*
+CREATE TABLE `print_transaction` (
+ `Print_TransactionID` int(11) NOT NULL AUTO_INCREMENT,
+ `Print_TransactionType` char(2) NOT NULL DEFAULT 'P' COMMENT 'P (paper), E (Email)',
+ `Print_TransactionCode` varchar(20) NOT NULL DEFAULT '',
+ `Print_TransactionName` varchar(150) NOT NULL DEFAULT '',
+ `Print_TransactionUrl` varchar(500) NOT NULL DEFAULT '',
+ `Print_TransactionParams` varchar(500) NOT NULL DEFAULT '',
+ `Print_TransactionCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `Print_TransactionCreatedUserID` int(11) NOT NULL DEFAULT 0,
+ `Print_TransactionLastUpdated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `Print_TransactionLastUpdatedUserID` int(11) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`Print_TransactionID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO `print_transaction` (`Print_TransactionID`, `Print_TransactionType`, `Print_TransactionCode`, `Print_TransactionName`, `Print_TransactionUrl`, `Print_TransactionParams`, `Print_TransactionCreated`, `Print_TransactionCreatedUserID`, `Print_TransactionLastUpdated`, `Print_TransactionLastUpdatedUserID`) VALUES
+(1, 'P', 'LAB-RESULT-P-01', 'Report hasil test lab untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 09:26:48', 555, '0000-00-00 00:00:00', 0),
+(2, 'P', 'LAB-RESULT-P-02', 'Report hasil test lab untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '0000-00-00 00:00:00', 555, '0000-00-00 00:00:00', 0),
+(3, 'P', 'LAB-RESULT-P-03', 'Report hasil test lab untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test_prev.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:32:54', 555, '0000-00-00 00:00:00', 0),
+(4, 'P', 'LAB-RESULT-NP-01', 'Report hasil test lab tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:25:02', 555, '0000-00-00 00:00:00', 0),
+(5, 'E', 'LAB-RESULT-NP-02', 'Report hasil test lab tidak untuk email', '/birt/frameset?__report=report/onelab/lab/rpt_test_email_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:25:51', 555, '0000-00-00 00:00:00', 0),
+(6, 'P', 'LAB-RESULT-NP-03', 'Report hasil test lab tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test_prev_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:25:51', 555, '0000-00-00 00:00:00', 0),
+(7, 'P', 'LABEN-RESULT-P-01', 'Report hasil test lab untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:32:09', 555, '0000-00-00 00:00:00', 0),
+(8, 'E', 'LABEN-RESULT-P-02', 'Report hasil test lab untuk email versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_email_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(9, 'P', 'LABEN-RESULT-P-03', 'Report hasil test lab untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_eng_prev.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(10, 'P', 'LABEN-RESULT-NP-01', 'Report hasil test lab tidak untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_not_print_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(11, 'P', 'MIKROEN-RESULT-P-01', 'Report hasil test mikro untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(12, 'E', 'MIKROEN-RESULT-P-02', 'Report hasil test mikro untuk email versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_email_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(13, 'P', 'MIKROEN-RESULT-P-03', 'Report hasil test mikro untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_eng_prev.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(14, 'P', 'MIKROEN-RESULT-NP-01', 'Report hasil test mikro tidak untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_not_print_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(45, 'P', 'PS-RESULT-P-01', 'Report hasil test preparasi sperma untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_sperma.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(46, 'E', 'PS-RESULT-P-02', 'Report hasil test preparasi sperma untuk email', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_sperma_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(47, 'P', 'PS-RESULT-NP-01', 'Report hasil test preparasi sperma tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_sperma_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(48, 'P', 'DFI-RESULT-P-01', 'Report hasil test dfi untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_dfi.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(49, 'E', 'DFI-RESULT-P-02', 'Report hasil test dfi untuk email', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_dfi_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(50, 'P', 'DFI-RESULT-NP-01', 'Report hasil test dfi tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_dfi_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(51, 'P', 'FNA-RESULT-P-01', 'Report hasil test fna untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_fna.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(52, 'E', 'FNA-RESULT-P-02', 'Report hasil test fna untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_fna_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(53, 'P', 'FNA-RESULT-NP-01', 'Report hasil test fna tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_fna_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(54, 'P', 'PA-RESULT-P-01', 'Report hasil test patologi anatomi untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_patologi_anatomy.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(55, 'E', 'PA-RESULT-P-02', 'Report hasil test patologi anatomi untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_patologi_anatomy_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(56, 'P', 'PA-RESULT-NP-01', 'Report hasil test patologi anatomi tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_patologi_anatomy_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(57, 'P', 'PAP-RESULT-P-01', 'Report hasil test pap smear untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_papsmear.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(58, 'E', 'PAP-RESULT-P-02', 'Report hasil test pap smear untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_papsmear_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(59, 'P', 'PAP-RESULT-NP-01', 'Report hasil test pap smear tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_papsmear_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(60, 'P', 'PAPLCP-RESULT-P-01', 'Report hasil test pap smear (liquid c prep) untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(61, 'E', 'PAPLCP-RESULT-P-02', 'Report hasil test pap smear (liquid c prep) untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(62, 'P', 'PAPLCP-RESULT-NP-01', 'Report hasil test pap smear (liquid c prep) tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(63, 'P', 'PAPLEN-RESULT-P-01', 'Report hasil test pap smear (liquid c prep) untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(64, 'E', 'PAPLEN-RESULT-P-02', 'Report hasil test pap smear (liquid c prep) untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_email_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(65, 'P', 'PAPLEN-RESULT-NP-01', 'Report hasil test pap smear (liquid c prep) tidak untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_not_print_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(66, 'P', 'MIKRO-RESULT-P-01', 'Report hasil test mikro untuk diprint terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_mikro.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(67, 'E', 'MIKRO-RESULT-P-02', 'Report hasil test mikro untuk email terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_mikro_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(68, 'P', 'MIKRO-RESULT-NP-01', 'Report hasil test mikro tidak untuk diprint terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_mikro_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(69, 'P', 'MIKROO-RESULT-P-01', 'Report hasil test mikro untuk diprint tidak terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(70, 'E', 'MIKROO-RESULT-P-02', 'Report hasil test mikro untuk email tidak terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(71, 'P', 'MIKROO-RESULT-NP-01', 'Report hasil test mikro untuk tidak diprint tidak terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(72, 'P', 'CT-RESULT-P-01', 'Report hasil test citology untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_cytologi.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(73, 'E', 'CT-RESULT-P-02', 'Report hasil test citology untuk email', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_cytologi_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(74, 'P', 'CT-RESULT-NP-01', 'Report hasil test citology untuk tidak diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_cytologi_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0);
+
+-- 2026-02-06 06:35:26
+ */
+}
diff --git a/application/libraries/Reporturl.php b/application/libraries/Reporturl.php
new file mode 100644
index 00000000..88459e66
--- /dev/null
+++ b/application/libraries/Reporturl.php
@@ -0,0 +1,138 @@
+db = $CI->load->database("onedev", true);
+ }
+
+ function get_report_by_code($report_code, $params){
+ $sql = "SELECT *
+ FROM print_transaction
+ WHERE
+ Print_TransactionCode = ? ";
+ $qry = $this->db->query($sql, array(
+ $report_code
+ ));
+
+ if (!$qry) {
+ return array(false, print_r($this->db->error(), true));
+ }
+
+ $rows_return = $qry->row_array();
+
+ return $rows_return;
+ }
+
+ function get_report_url_by_code($report_code, $params = array(), $show='N'){
+ $CI = &get_instance();
+ $this->db = $CI->load->database("onedev", true);
+
+ // Get report data by code
+ $report_data = $this->get_report_by_code($report_code, $params);
+
+ if (!$report_data || empty($report_data)) {
+ return array(false, "Report code not found: " . $report_code);
+ }
+
+ // Get URL template
+ $url_template = $report_data['Print_TransactionUrl'];
+
+ if (empty($url_template)) {
+ return array(false, "URL template is empty for report code: " . $report_code);
+ }
+
+ // Replace placeholders with actual parameter values
+ $final_url = $url_template;
+
+ foreach ($params as $param_key => $param_value) {
+ // Determine if value should be quoted (string) or not (numeric)
+ $replacement_value = is_numeric($param_value) ? $param_value : "'" . $param_value . "'";
+
+ // Replace placeholder in URL
+ $final_url = str_replace($param_key, $replacement_value, $final_url);
+ }
+
+ if($show == 'N'){
+ return array(true, $final_url);
+ }
+ else{
+ $final_url = 'http'.($_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].$final_url;
+
+ $response = file_get_contents($final_url);
+ header("Content-type: application/pdf");
+ header(
+ 'Content-Disposition: inline; filename="' .
+ $output_file_name .
+ '"'
+ );
+ echo ($response);
+ }
+
+ }
+ /*
+CREATE TABLE `print_transaction` (
+ `Print_TransactionID` int(11) NOT NULL AUTO_INCREMENT,
+ `Print_TransactionType` char(2) NOT NULL DEFAULT 'P' COMMENT 'P (paper), E (Email)',
+ `Print_TransactionCode` varchar(20) NOT NULL DEFAULT '',
+ `Print_TransactionName` varchar(150) NOT NULL DEFAULT '',
+ `Print_TransactionUrl` varchar(500) NOT NULL DEFAULT '',
+ `Print_TransactionParams` varchar(500) NOT NULL DEFAULT '',
+ `Print_TransactionCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `Print_TransactionCreatedUserID` int(11) NOT NULL DEFAULT 0,
+ `Print_TransactionLastUpdated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `Print_TransactionLastUpdatedUserID` int(11) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`Print_TransactionID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO `print_transaction` (`Print_TransactionID`, `Print_TransactionType`, `Print_TransactionCode`, `Print_TransactionName`, `Print_TransactionUrl`, `Print_TransactionParams`, `Print_TransactionCreated`, `Print_TransactionCreatedUserID`, `Print_TransactionLastUpdated`, `Print_TransactionLastUpdatedUserID`) VALUES
+(1, 'P', 'LAB-RESULT-P-01', 'Report hasil test lab untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 09:26:48', 555, '0000-00-00 00:00:00', 0),
+(2, 'P', 'LAB-RESULT-P-02', 'Report hasil test lab untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '0000-00-00 00:00:00', 555, '0000-00-00 00:00:00', 0),
+(3, 'P', 'LAB-RESULT-P-03', 'Report hasil test lab untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test_prev.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:32:54', 555, '0000-00-00 00:00:00', 0),
+(4, 'P', 'LAB-RESULT-NP-01', 'Report hasil test lab tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:25:02', 555, '0000-00-00 00:00:00', 0),
+(5, 'E', 'LAB-RESULT-NP-02', 'Report hasil test lab tidak untuk email', '/birt/frameset?__report=report/onelab/lab/rpt_test_email_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:25:51', 555, '0000-00-00 00:00:00', 0),
+(6, 'P', 'LAB-RESULT-NP-03', 'Report hasil test lab tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_test_prev_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:25:51', 555, '0000-00-00 00:00:00', 0),
+(7, 'P', 'LABEN-RESULT-P-01', 'Report hasil test lab untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:32:09', 555, '0000-00-00 00:00:00', 0),
+(8, 'E', 'LABEN-RESULT-P-02', 'Report hasil test lab untuk email versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_email_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(9, 'P', 'LABEN-RESULT-P-03', 'Report hasil test lab untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_eng_prev.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(10, 'P', 'LABEN-RESULT-NP-01', 'Report hasil test lab tidak untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_not_print_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(11, 'P', 'MIKROEN-RESULT-P-01', 'Report hasil test mikro untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(12, 'E', 'MIKROEN-RESULT-P-02', 'Report hasil test mikro untuk email versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_email_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(13, 'P', 'MIKROEN-RESULT-P-03', 'Report hasil test mikro untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_eng_prev.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(14, 'P', 'MIKROEN-RESULT-NP-01', 'Report hasil test mikro tidak untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_test_not_print_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 10:34:57', 555, '0000-00-00 00:00:00', 0),
+(45, 'P', 'PS-RESULT-P-01', 'Report hasil test preparasi sperma untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_sperma.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(46, 'E', 'PS-RESULT-P-02', 'Report hasil test preparasi sperma untuk email', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_sperma_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(47, 'P', 'PS-RESULT-NP-01', 'Report hasil test preparasi sperma tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_sperma_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(48, 'P', 'DFI-RESULT-P-01', 'Report hasil test dfi untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_dfi.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(49, 'E', 'DFI-RESULT-P-02', 'Report hasil test dfi untuk email', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_dfi_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(50, 'P', 'DFI-RESULT-NP-01', 'Report hasil test dfi tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_dfi_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(51, 'P', 'FNA-RESULT-P-01', 'Report hasil test fna untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_fna.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(52, 'E', 'FNA-RESULT-P-02', 'Report hasil test fna untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_fna_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(53, 'P', 'FNA-RESULT-NP-01', 'Report hasil test fna tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_fna_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(54, 'P', 'PA-RESULT-P-01', 'Report hasil test patologi anatomi untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_patologi_anatomy.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(55, 'E', 'PA-RESULT-P-02', 'Report hasil test patologi anatomi untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_patologi_anatomy_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(56, 'P', 'PA-RESULT-NP-01', 'Report hasil test patologi anatomi tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_patologi_anatomy_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(57, 'P', 'PAP-RESULT-P-01', 'Report hasil test pap smear untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_papsmear.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(58, 'E', 'PAP-RESULT-P-02', 'Report hasil test pap smear untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_papsmear_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(59, 'P', 'PAP-RESULT-NP-01', 'Report hasil test pap smear tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_papsmear_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(60, 'P', 'PAPLCP-RESULT-P-01', 'Report hasil test pap smear (liquid c prep) untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(61, 'E', 'PAPLCP-RESULT-P-02', 'Report hasil test pap smear (liquid c prep) untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(62, 'P', 'PAPLCP-RESULT-NP-01', 'Report hasil test pap smear (liquid c prep) tidak untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(63, 'P', 'PAPLEN-RESULT-P-01', 'Report hasil test pap smear (liquid c prep) untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(64, 'E', 'PAPLEN-RESULT-P-02', 'Report hasil test pap smear (liquid c prep) untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_email_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(65, 'P', 'PAPLEN-RESULT-NP-01', 'Report hasil test pap smear (liquid c prep) tidak untuk diprint versi inggris', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_lcprep_not_print_eng.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(66, 'P', 'MIKRO-RESULT-P-01', 'Report hasil test mikro untuk diprint terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_mikro.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(67, 'E', 'MIKRO-RESULT-P-02', 'Report hasil test mikro untuk email terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_mikro_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(68, 'P', 'MIKRO-RESULT-NP-01', 'Report hasil test mikro tidak untuk diprint terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_mikro_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(69, 'P', 'MIKROO-RESULT-P-01', 'Report hasil test mikro untuk diprint tidak terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(70, 'E', 'MIKROO-RESULT-P-02', 'Report hasil test mikro untuk email tidak terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(71, 'P', 'MIKROO-RESULT-NP-01', 'Report hasil test mikro untuk tidak diprint tidak terlampir', '/birt/frameset?__report=report/onelab/lab/rpt_test_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(72, 'P', 'CT-RESULT-P-01', 'Report hasil test citology untuk diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_cytologi.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(73, 'E', 'CT-RESULT-P-02', 'Report hasil test citology untuk email', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_cytologi_email.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0),
+(74, 'P', 'CT-RESULT-NP-01', 'Report hasil test citology untuk tidak diprint', '/birt/frameset?__report=report/onelab/lab/rpt_hasil_cytologi_not_print.rptdesign&__format=pdf&username=PUsername&PID=PT_OrderHeaderID&tm=TS', 'PUsername,PT_OrderHeaderID,TS', '2026-02-06 11:24:51', 555, '0000-00-00 00:00:00', 0);
+
+-- 2026-02-06 06:35:26
+ */
+}
diff --git a/application/libraries/Resultcalc-bkp.php b/application/libraries/Resultcalc-bkp.php
new file mode 100644
index 00000000..c7680ee4
--- /dev/null
+++ b/application/libraries/Resultcalc-bkp.php
@@ -0,0 +1,113 @@
+db = $CI->load->database("onedev",true);
+ $sql = "select
+ T_TestCalculationID,T_TestCalculationFormula,
+ T_OrderDetailID, T_OrderDetailT_TestID, T_TestNat_TestID Nat_TestID,
+ T_TestCalculationID,T_OrderDetailResult,
+ fn_global_age_count_day(M_PatientDOB, date(T_OrderHeaderDate)) / 365 AgeInYear,
+ T_TestCalculationNat_SexID
+ from t_orderdetail
+ join t_orderheader on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
+ and T_OrderHeaderID = ?
+ join m_patient on T_OrderHeaderM_PatientID = M_PatientID
+ join t_test on T_OrderDetailT_TestID = T_TestID
+ and T_OrderDetailIsActive = 'Y' and T_TestIsActive = 'Y'
+ join t_testcalculation on T_TestNat_TestID = T_TestCalculationNat_TestID
+ and T_TestCalculationIsActive = 'Y'
+ and (
+ T_TestCalculationNat_SexID = M_PatientM_SexID
+ or
+ T_TestCalculationNat_SexID = 0
+ )
+ ";
+
+ $sql_det = "select T_TestCalculationDetailCode, T_OrderDetailResult
+ from
+ t_testcalculation_detail td
+ join t_testcalculation on T_TestCalculationID = T_TestCalculationDetailT_TestCalculationID
+ and T_TestCalculationID = ?
+ join t_test t on td.T_TestCalculationDetailNat_TestID = T_TestNat_TestID
+ left join t_orderdetail on T_TestID = T_OrderDetailT_TestID and T_OrderDetailIsActive = 'Y'
+ and T_OrderDetailT_OrderHeaderID = ?
+ where T_OrderDetailID is not null";
+
+
+ $qry = $this->db->query($sql, array($id));
+ $rows = $qry->result_array();
+
+ if ( count($rows) > 0 ) {
+ foreach($rows as $r) {
+ $tc_id = $r["T_TestCalculationID"];
+ $formula = $r["T_TestCalculationFormula"];
+ $qry_det = $this->db->query($sql_det, array($tc_id, $id));
+ $drows = $qry_det->result_array();
+ $have_all = true;
+ $have_one = false;
+ $formula = str_replace("AGE",$r["AgeInYear"], $formula);
+ $flag_recursive = false;
+ if (strpos($formula,"[REC]") > -1 ) {
+ $flag_recursive = true;
+ }
+ if ( ! $flag_recursive ) {
+ if( trim($r["T_OrderDetailResult"]) != "") continue;
+ }
+
+ $formula = str_replace("[REC]","", $formula);
+ foreach($drows as $dr) {
+ $code = $dr["T_TestCalculationDetailCode"];
+ $value = $dr["T_OrderDetailResult"];
+ if($dr["T_OrderDetailResult"] == "" ) {
+ $have_all = false;
+ break;
+ }
+ $have_one = true;
+ $formula = str_replace($code, $value,$formula);
+ }
+ if ($have_all && $have_one) {
+
+ eval("\$f_value = $formula;");
+ //formating
+ //echo "\n$f_value ..";
+ //file_put_contents("/xtmp/formula",$f_value. "\n",FILE_APPEND);
+ if (is_numeric($f_value)) {
+ $f_value = $this->format_value($f_value,$r["Nat_TestID"]);
+ }
+ //file_put_contents("/xtmp/formula",$f_value. "\n",FILE_APPEND);
+ $od_id = $r["T_OrderDetailID"];
+ $sql = "update t_orderdetail set T_OrderDetailResult = ?
+ where T_OrderDetailID = ?";
+ $this->db->query($sql, array($f_value,$od_id));
+ }
+ }
+ }
+ }
+ function format_value($f_value, $nat_test_id){
+ $CI =& get_instance();
+ $this->db = $CI->load->database("onedev",true);
+ $sql = "select * from m_instrumentmethode
+ where M_InstrumentMethodeIsActive = 'Y'
+ and M_InstrumentMethodeNat_TestID = ?
+ limit 0,1";
+ $qry = $this->db->query($sql, array($nat_test_id) );
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0 ) {
+ if ($f_value > 0 ) {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatAboveSF"];
+ } else {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatSF"];
+ }
+ $idx = strpos($fmt,".");
+ $dec = strlen($fmt) - $idx;
+ if ($dec > 0 ) $dec = $dec -1;
+ return number_format($f_value,$dec);
+ }
+ }
+ return number_format($f_value,0,".",",");
+ }
+}
diff --git a/application/libraries/Resultcalc-new.php b/application/libraries/Resultcalc-new.php
new file mode 100644
index 00000000..d21256d0
--- /dev/null
+++ b/application/libraries/Resultcalc-new.php
@@ -0,0 +1,107 @@
+db = $CI->load->database("onedev",true);
+ $sql = "select
+ T_TestCalculationID,T_TestCalculationFormula,
+ T_OrderDetailID, T_OrderDetailT_TestID, T_TestNat_TestID Nat_TestID,
+ T_TestCalculationID,T_OrderDetailResult,
+ fn_global_age_count_day(M_PatientDOB, date(T_OrderHeaderDate)) / 365 AgeInYear,
+ T_TestCalculationNat_SexID
+ from t_orderdetail
+ join t_orderheader on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
+ and T_OrderHeaderID = ?
+ join m_patient on T_OrderHeaderM_PatientID = M_PatientID
+ join t_test on T_OrderDetailT_TestID = T_TestID
+ and T_OrderDetailIsActive = 'Y' and T_TestIsActive = 'Y'
+ join t_testcalculation on T_TestNat_TestID = T_TestCalculationNat_TestID
+ and T_TestCalculationIsActive = 'Y'
+ and (
+ T_TestCalculationNat_SexID = M_PatientM_SexID
+ or
+ T_TestCalculationNat_SexID = 0
+ )
+ ";
+
+ $sql_det = "select T_TestCalculationDetailCode, T_OrderDetailResult
+ from
+ t_testcalculation_detail td
+ join t_testcalculation on T_TestCalculationID = T_TestCalculationDetailT_TestCalculationID
+ and T_TestCalculationID = ?
+ join t_test t on td.T_TestCalculationDetailNat_TestID = T_TestNat_TestID
+ left join t_orderdetail on T_TestID = T_OrderDetailT_TestID and T_OrderDetailIsActive = 'Y'
+ and T_OrderDetailT_OrderHeaderID = ?
+ where T_OrderDetailID is not null";
+
+
+ $qry = $this->db->query($sql, array($id));
+ $rows = $qry->result_array();
+ if ( count($rows) > 0 ) {
+ foreach($rows as $r) {
+ $tc_id = $r["T_TestCalculationID"];
+ $qry_det = $this->db->query($sql_det, array($tc_id, $id));
+ $drows = $qry_det->result_array();
+ $formula = $r["T_TestCalculationFormula"];
+ $have_all = true;
+ $have_one = false;
+ $formula = str_replace("AGE",$r["AgeInYear"], $formula);
+ $flag_recursive = false;
+ if (strpos($formula,"[REC]") > -1 ) {
+ $flag_recursive = true;
+ }
+ if ( ! $flag_recursive ) {
+ if( $r["T_OrderDetailResult"] != "") continue;
+ }
+ $formula = str_replace("[REC]","", $formula);
+ foreach($drows as $dr) {
+ if($dr["T_OrderDetailResult"] == "" ) {
+ $have_all = false;
+ break;
+ }
+ $have_one = true;
+ $code = $dr["T_TestCalculationDetailCode"];
+ $value = $dr["T_OrderDetailResult"];
+ $formula = str_replace($code, $value,$formula);
+ }
+ if ($have_all && $have_one) {
+
+ eval("\$f_value = $formula;");
+ file_put_contents("/xtmp/formula",$formula . "\n",FILE_APPEND);
+ //formating
+ $f_value = $this->format_value($f_value,$r["Nat_TestID"]);
+ $od_id = $r["T_OrderDetailID"];
+ $sql = "update t_orderdetail set T_OrderDetailResult = ?
+ where T_OrderDetailID = ?";
+ $this->db->query($sql, array($f_value,$od_id));
+ }
+ }
+ }
+ }
+ function format_value($f_value, $nat_test_id){
+ $CI =& get_instance();
+ $this->db = $CI->load->database("onedev",true);
+ $sql = "select * from m_instrumentmethode
+ where M_InstrumentMethodeIsActive = 'Y'
+ and M_InstrumentMethodeNat_TestID = ?
+ limit 0,1";
+ $qry = $this->db->query($sql, array($nat_test_id) );
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0 ) {
+ if ($f_value > 0 ) {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatAboveSF"];
+ } else {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatSF"];
+ }
+ $idx = strpos($fmt,".");
+ $dec = strlen($fmt) - $idx;
+ if ($dec > 0 ) $dec = $dec -1;
+ return number_format($f_value,$dec);
+ }
+ }
+ return number_format($f_value,0,".",",");
+ }
+}
diff --git a/application/libraries/Resultcalc-riau.php b/application/libraries/Resultcalc-riau.php
new file mode 100644
index 00000000..fc7f8bb0
--- /dev/null
+++ b/application/libraries/Resultcalc-riau.php
@@ -0,0 +1,110 @@
+db = $CI->load->database("onedev",true);
+ $sql = "select
+ T_TestCalculationID,T_TestCalculationFormula,
+ T_OrderDetailID, T_OrderDetailT_TestID, T_TestNat_TestID Nat_TestID,
+ T_TestCalculationID,T_OrderDetailResult,
+ fn_global_age_count_day(M_PatientDOB, date(T_OrderHeaderDate)) / 365 AgeInYear,
+ T_TestCalculationNat_SexID
+ from t_orderdetail
+ join t_orderheader on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
+ and T_OrderHeaderID = ?
+ join m_patient on T_OrderHeaderM_PatientID = M_PatientID
+ join t_test on T_OrderDetailT_TestID = T_TestID
+ and T_OrderDetailIsActive = 'Y' and T_TestIsActive = 'Y'
+ join t_testcalculation on T_TestNat_TestID = T_TestCalculationNat_TestID
+ and T_TestCalculationIsActive = 'Y'
+ and (
+ T_TestCalculationNat_SexID = M_PatientM_SexID
+ or
+ T_TestCalculationNat_SexID = 0
+ )
+ ";
+
+ $sql_det = "select T_TestCalculationDetailCode, T_OrderDetailResult
+ from
+ t_testcalculation_detail td
+ join t_testcalculation on T_TestCalculationID = T_TestCalculationDetailT_TestCalculationID
+ and T_TestCalculationID = ?
+ join t_test t on td.T_TestCalculationDetailNat_TestID = T_TestNat_TestID
+ left join t_orderdetail on T_TestID = T_OrderDetailT_TestID and T_OrderDetailIsActive = 'Y'
+ and T_OrderDetailT_OrderHeaderID = ?
+ where T_OrderDetailID is not null";
+
+
+ $qry = $this->db->query($sql, array($id));
+ $rows = $qry->result_array();
+ if ( count($rows) > 0 ) {
+ foreach($rows as $r) {
+ $tc_id = $r["T_TestCalculationID"];
+ $qry_det = $this->db->query($sql_det, array($tc_id, $id));
+ $drows = $qry_det->result_array();
+ $formula = $r["T_TestCalculationFormula"];
+ $have_all = true;
+ $have_one = false;
+ $formula = str_replace("AGE",$r["AgeInYear"], $formula);
+ $flag_recursive = false;
+ if (strpos($formula,"[REC]") > -1 ) {
+ $flag_recursive = true;
+ }
+ //echo "$formula " . $r["T_OrderDetailResult"] . "\n";
+ if ( ! $flag_recursive ) {
+ if( trim($r["T_OrderDetailResult"]) != "") continue;
+ }
+
+ $formula = str_replace("[REC]","", $formula);
+ foreach($drows as $dr) {
+ $code = $dr["T_TestCalculationDetailCode"];
+ $value = $dr["T_OrderDetailResult"];
+ //echo "$code , $value , $formula \n";
+ if($dr["T_OrderDetailResult"] == "" ) {
+ $have_all = false;
+ break;
+ }
+ $have_one = true;
+ $formula = str_replace($code, $value,$formula);
+ }
+ if ($have_all && $have_one) {
+
+ eval("\$f_value = $formula;");
+ //formating
+ //echo "\n$f_value ..";
+ $f_value = $this->format_value($f_value,$r["Nat_TestID"]);
+ $od_id = $r["T_OrderDetailID"];
+ $sql = "update t_orderdetail set T_OrderDetailResult = ?
+ where T_OrderDetailID = ?";
+ $this->db->query($sql, array($f_value,$od_id));
+ }
+ }
+ }
+ }
+ function format_value($f_value, $nat_test_id){
+ $CI =& get_instance();
+ $this->db = $CI->load->database("onedev",true);
+ $sql = "select * from m_instrumentmethode
+ where M_InstrumentMethodeIsActive = 'Y'
+ and M_InstrumentMethodeNat_TestID = ?
+ limit 0,1";
+ $qry = $this->db->query($sql, array($nat_test_id) );
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0 ) {
+ if ($f_value > 0 ) {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatAboveSF"];
+ } else {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatSF"];
+ }
+ $idx = strpos($fmt,".");
+ $dec = strlen($fmt) - $idx;
+ if ($dec > 0 ) $dec = $dec -1;
+ return number_format($f_value,$dec);
+ }
+ }
+ return number_format($f_value,0,".",",");
+ }
+}
diff --git a/application/libraries/Resultcalc.php b/application/libraries/Resultcalc.php
new file mode 100644
index 00000000..7205eefd
--- /dev/null
+++ b/application/libraries/Resultcalc.php
@@ -0,0 +1,175 @@
+db = $CI->load->database("onedev", true);
+ $sql = "select
+ T_TestCalculationID,T_TestCalculationFormula,
+ T_OrderDetailID, T_OrderDetailT_TestID, T_TestNat_TestID Nat_TestID,
+ T_TestCalculationID,T_OrderDetailResult,
+ fn_global_age_count_day(M_PatientDOB, date(T_OrderHeaderDate)) / 365 AgeInYear,
+ T_TestCalculationNat_SexID,
+ T_OrderDetailT_TestName
+ from t_orderdetail
+ join t_orderheader on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
+ and T_OrderHeaderID = ?
+ join m_patient on T_OrderHeaderM_PatientID = M_PatientID
+ join t_test on T_OrderDetailT_TestID = T_TestID
+ and T_OrderDetailIsActive = 'Y' and T_TestIsActive = 'Y'
+ join t_testcalculation on T_TestNat_TestID = T_TestCalculationNat_TestID
+ and T_TestCalculationIsActive = 'Y'
+ and (
+ T_TestCalculationNat_SexID = M_PatientM_SexID
+ or
+ T_TestCalculationNat_SexID = 0
+ )
+ ";
+
+ $sql_det = "select T_OrderDetailT_TestName, T_TestCalculationDetailCode, T_OrderDetailResult
+ from
+ t_testcalculation_detail td
+ join t_testcalculation on T_TestCalculationID = T_TestCalculationDetailT_TestCalculationID
+ and T_TestCalculationID = ? and T_TestCalculationDetailIsActive = 'Y'
+ join t_test t on td.T_TestCalculationDetailNat_TestID = T_TestNat_TestID
+ left join t_orderdetail on T_TestID = T_OrderDetailT_TestID and T_OrderDetailIsActive = 'Y'
+ and T_OrderDetailT_OrderHeaderID = ?
+ Order by T_TestCalculationDetailCode,T_OrderDetailResult desc";
+ //where T_OrderDetailID is not null";
+
+
+ $qry = $this->db->query($sql, array($id));
+ $date = date("Y-m-d H:i:s");
+ //file_put_contents("/xtmp/debug-calc.log", "$date : {$this->db->last_query()} \n");
+ $rows = $qry->result_array();
+ if ($debug != "") {
+ print_r($rows);
+ }
+
+ if (count($rows) > 0) {
+ foreach ($rows as $r) {
+ $tc_id = $r["T_TestCalculationID"];
+ $qry_det = $this->db->query($sql_det, array($tc_id, $id));
+ $drows = $qry_det->result_array();
+ $formula = $r["T_TestCalculationFormula"];
+ $have_all = true;
+ $have_one = false;
+ $formula = str_replace("AGE", $r["AgeInYear"], $formula);
+ $flag_recursive = false;
+ if (strpos($formula, "[REC]") > -1) {
+ $flag_recursive = true;
+ }
+ if (!$flag_recursive) {
+ if (trim($r["T_OrderDetailResult"]) != "") continue;
+ }
+
+ $formula = str_replace("[REC]", "", $formula);
+ $org_formula = $formula;
+ $s_code_value = "";
+ $tc_name = $r["T_OrderDetailT_TestName"];
+
+ $arr_code = array();
+
+ $arr_param = [];
+ foreach ($drows as $dr) {
+ $code = $dr["T_TestCalculationDetailCode"];
+ $value = $dr["T_OrderDetailResult"];
+ $s_code_value .= "^$code=$value";
+ $arr_param[] = $code;
+ if (isset($arr_code[$code])) continue;
+ $arr_code[$code] = "exist";
+ if ($dr["T_OrderDetailResult"] == "" || $dr["T_OrderDetailResult"] == "-") {
+ $have_all = false;
+ break;
+ }
+ $arr_code[$code] = $value;
+ $have_one = true;
+ $formula = str_replace($code, $value, $formula);
+ }
+ $have_all = true;
+ if (count($arr_param) == 0) $have_all = false;
+ foreach($arr_param as $p) {
+ if ($debug != "") {
+ echo "code $p : ";
+ }
+ if (!isset($arr_code[$p])) {
+ if ($debug != "") {
+ echo "not exists \n";
+ }
+ $have_all = false;
+ break;
+ } else {
+ if ($arr_code[$p] == "exist") {
+ $have_all = false;
+ }
+ if ($debug != "") {
+ echo "exists : {$arr_code[$p]} \n";
+ }
+ }
+ }
+ if ($debug != "") {
+ echo "$formula " . $r["T_OrderDetailResult"] . "\n";
+ echo "-- have one : " . $have_one ? "Y" : "N";
+ echo "\n";
+ echo "-- have all : " . $have_all ? "Y" : "N";
+ echo "\n";
+ }
+ if ($have_all && $have_one) {
+
+ $date = date("Y-m-d H:i:s");
+ try {
+ // file_put_contents("/xtmp/debug-calc.log", "$date : $tc_name => \$f_value = $formula; \n");
+ // file_put_contents("/xtmp/debug-calc.log", "$date : Formula : $org_formula\n",FILE_APPEND);
+ // file_put_contents("/xtmp/debug-calc.log", print_r($drows,true),FILE_APPEND);
+
+ eval("\$f_value = $formula;");
+ //formating
+ $f_value = $this->format_value($f_value, $r["Nat_TestID"]);
+ if (is_numeric($f_value)) {
+ $f_value = $this->format_value($f_value, $r["Nat_TestID"]);
+ }
+ $od_id = $r["T_OrderDetailID"];
+ $sql = "update t_orderdetail set T_OrderDetailResult = ?
+ where T_OrderDetailID = ?";
+ $this->db->query($sql, array($f_value, $od_id));
+
+ if ($tc_id == 2) {
+ $sql = "insert into t_order_calc(T_OrderCalcT_OrderDetailID,
+ T_OrderCalcFormula,T_OrderCalcResult) values(?,?,?)";
+ $this->db->query($sql, array($od_id, $formula . " | " . $s_code_value, $f_value));
+ }
+ } catch (Exception $e) {
+ //print_r($e);
+ }
+ }
+ }
+ }
+ }
+ function format_value($f_value, $nat_test_id)
+ {
+ $CI = &get_instance();
+ $this->db = $CI->load->database("onedev", true);
+ $sql = "select * from m_instrumentmethode
+ where M_InstrumentMethodeIsActive = 'Y'
+ and M_InstrumentMethodeNat_TestID = ?
+ limit 0,1";
+ $qry = $this->db->query($sql, array($nat_test_id));
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0) {
+ if ($f_value > 0) {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatAboveSF"];
+ } else {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatSF"];
+ }
+ $idx = strpos($fmt, ".");
+ $dec = strlen($fmt) - $idx;
+ if ($dec > 0) $dec = $dec - 1;
+ return number_format($f_value, $dec);
+ }
+ }
+ return number_format($f_value, 0, ".", ",");
+ }
+}
diff --git a/application/libraries/Resultcalcv2.php b/application/libraries/Resultcalcv2.php
new file mode 100644
index 00000000..e36d34c1
--- /dev/null
+++ b/application/libraries/Resultcalcv2.php
@@ -0,0 +1,116 @@
+db = $CI->load->database("onedev",true);
+ $sql = "select
+ T_TestCalculationID,T_TestCalculationFormula,
+ T_OrderDetailID, T_OrderDetailT_TestID, T_TestNat_TestID Nat_TestID,
+ T_TestCalculationID,T_OrderDetailResult,
+ fn_global_age_count_day(M_PatientDOB, date(T_OrderHeaderDate)) / 365 AgeInYear,
+ T_TestCalculationNat_SexID
+ from t_orderdetail
+ join t_orderheader on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
+ and T_OrderHeaderID = ?
+ join m_patient on T_OrderHeaderM_PatientID = M_PatientID
+ join t_test on T_OrderDetailT_TestID = T_TestID
+ and T_OrderDetailIsActive = 'Y' and T_TestIsActive = 'Y'
+ join t_testcalculation on T_TestNat_TestID = T_TestCalculationNat_TestID
+ and T_TestCalculationIsActive = 'Y'
+ and (
+ T_TestCalculationNat_SexID = M_PatientM_SexID
+ or
+ T_TestCalculationNat_SexID = 0
+ )
+ ";
+
+ $sql_det = "select T_TestCalculationDetailCode, T_OrderDetailResult
+ from
+ t_testcalculation_detail td
+ join t_testcalculation on T_TestCalculationID = T_TestCalculationDetailT_TestCalculationID
+ and T_TestCalculationID = ?
+ join t_test t on td.T_TestCalculationDetailNat_TestID = T_TestNat_TestID
+ left join t_orderdetail on T_TestID = T_OrderDetailT_TestID and T_OrderDetailIsActive = 'Y'
+ and T_OrderDetailT_OrderHeaderID = ?
+ where T_OrderDetailID is not null";
+
+
+ $qry = $this->db->query($sql, array($id));
+ $rows = $qry->result_array();
+ if ( count($rows) > 0 ) {
+ foreach($rows as $r) {
+ $tc_id = $r["T_TestCalculationID"];
+ $qry_det = $this->db->query($sql_det, array($tc_id, $id));
+ $drows = $qry_det->result_array();
+ $formula = $r["T_TestCalculationFormula"];
+ $have_all = true;
+ $have_one = false;
+ $formula = str_replace("AGE",$r["AgeInYear"], $formula);
+ $flag_recursive = false;
+ if (strpos($formula,"[REC]") > -1 ) {
+ $flag_recursive = true;
+ }
+ echo "$formula " . $r["T_OrderDetailResult"] . "\n";
+ if ( ! $flag_recursive ) {
+ if( trim($r["T_OrderDetailResult"]) != "") continue;
+ }
+
+ $formula = str_replace("[REC]","", $formula);
+ foreach($drows as $dr) {
+ $code = $dr["T_TestCalculationDetailCode"];
+ $value = $dr["T_OrderDetailResult"];
+ echo "$code , $value , $formula \n";
+ if($dr["T_OrderDetailResult"] == "" ) {
+ $have_all = false;
+ break;
+ }
+ $have_one = true;
+ $formula = str_replace($code, $value,$formula);
+ }
+ if ($have_all && $have_one) {
+
+ eval("\$f_value = $formula;");
+ //formating
+ echo "\n$f_value ..";
+ $f_value = $this->format_value($f_value,$r["Nat_TestID"]);
+ if (is_numeric($f_value)) {
+ $f_value = $this->format_value($f_value,$r["Nat_TestID"]);
+ }
+ $od_id = $r["T_OrderDetailID"];
+ $sql = "update t_orderdetail set T_OrderDetailResult = ?
+ where T_OrderDetailID = ?";
+ $this->db->query($sql, array($f_value,$od_id));
+ $sql = "insert into t_order_calc(T_OrderCalcT_OrderDetailID,
+ T_OrderCalcFormula,T_OrderCalcResult) values(?,?,?)";
+ $this->db->query($sql, array($od_id,$formula,$f_value));
+ }
+ }
+ }
+ }
+ function format_value($f_value, $nat_test_id){
+ $CI =& get_instance();
+ $this->db = $CI->load->database("onedev",true);
+ $sql = "select * from m_instrumentmethode
+ where M_InstrumentMethodeIsActive = 'Y'
+ and M_InstrumentMethodeNat_TestID = ?
+ limit 0,1";
+ $qry = $this->db->query($sql, array($nat_test_id) );
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0 ) {
+ if ($f_value > 0 ) {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatAboveSF"];
+ } else {
+ $fmt = $rows[0]["M_InstrumentMethodeResultFormatSF"];
+ }
+ $idx = strpos($fmt,".");
+ $dec = strlen($fmt) - $idx;
+ if ($dec > 0 ) $dec = $dec -1;
+ return number_format($f_value,$dec);
+ }
+ }
+ return number_format($f_value,0,".",",");
+ }
+}
diff --git a/application/libraries/Sas_s3.php b/application/libraries/Sas_s3.php
new file mode 100644
index 00000000..fec64826
--- /dev/null
+++ b/application/libraries/Sas_s3.php
@@ -0,0 +1,49 @@
+bucket = "audio-sample";
+ $this->s3 = new Aws\S3\S3Client([
+ "region" => "us-east-1",
+ "endpoint" => $this->endpoint,
+ "use_path_style_endpoint" => true,
+ "credentials" => [
+ "key" => "DLBFBBB8R22W4B5IE7PC",
+ "secret" => "byCv726DN1TCQvLVHdSLMJg3K0i3Ajhm4rXPAVCu"
+ ]
+ ]);
+ }
+ function create_bucket($bucket)
+ {
+ $result = $this->s3->createBucket(["Bucket" => $bucket]);
+ return $result;
+ }
+ function upload($bucket, $key, $contentType, $body)
+ {
+ $result = $this->s3->putObject(
+ [
+ "Bucket" => $bucket,
+ "Key" => $key,
+ "Body" => $body,
+ "ContentType" => $contentType
+ ]
+ );
+ return $result;
+ }
+ // avail : 10 minutes
+ function show_url($bucket, $key, $avail)
+ {
+ $cmd = $this->s3->getCommand("GetObject", ['Bucket' => $bucket, 'Key' => $key]);
+ $request = $this->s3->createPresignedRequest($cmd, '+20 minutes');
+ $presignedUrl = $request->getUri();
+ return $presignedUrl;
+ }
+}
diff --git a/application/libraries/Satu_sehat.php b/application/libraries/Satu_sehat.php
new file mode 100644
index 00000000..02f762d6
--- /dev/null
+++ b/application/libraries/Satu_sehat.php
@@ -0,0 +1,584 @@
+tz = "+07:00";
+ $this->is_staging = false;
+ $this->base_url = "https://api-satusehat.kemkes.go.id/fhir-r4/v1";
+ $this->base_oauth_url = "https://api-satusehat.kemkes.go.id/oauth2/v1";
+ $this->base_consent_url = "https://api-satusehat.dto.kemkes.go.id/consent/v1";
+ $CI = &get_instance();
+ $this->db = $CI->load->database("default", true);
+
+ $this->dbname = "one_health";
+ if ($this->is_staging) {
+ $this->base_url = "https://api-satusehat-stg.kemkes.go.id/fhir-r4/v1";
+ $this->base_oauth_url = "https://api-satusehat-stg.kemkes.go.id/oauth2/v1";
+ $this->base_consent_url = "https://api-satusehat-stg.dto.kemkes.go.id/consent/v1";
+ $this->dbname = "one_health_dev";
+ }
+ $this->get_organization_id();
+ }
+ function load_clinic()
+ {
+ $this->dbname = "one_health_clinic";
+ }
+ function ss_organization()
+ {
+ $this->get_organization_id();
+ $o_resp = $this->ss_get("/Organization/{$this->organizationID}");
+ $resp = $this->objToArray($o_resp);
+ $id = $resp["id"];
+ $name = $resp["name"];
+ $x_type = $resp["type"][0]["coding"][0];
+ $type = $x_type["display"];
+ $code = $x_type["code"];
+ $system = $x_type["system"];
+ return json_encode([
+ "ID" => $id,
+ "Name" => $name,
+ "Type" => $type,
+ "CodeSystem" => $code . " | " . $system,
+ ]);
+ }
+
+ function search_practicioner_by_nik($nik, $debug = "")
+ {
+ $service = "/Practitioner?identifier=https://fhir.kemkes.go.id/id/nik|" . $nik;
+ $o_resp = $this->ss_get($service, $debug);
+ $resp = $this->objToArray($o_resp);
+ if (count($resp["entry"]) > 0) {
+ $rs = $resp["entry"][0]["resource"];
+ return json_encode([
+ "status" => "OK",
+ "ihsID" => $rs["id"],
+ "name" => $rs["name"][0]["text"]
+ ]);
+ }
+ return json_encode([
+ "status" => "ERR",
+ "message" => "Practitioner not found [$nik]"
+ ]);
+ }
+
+ function search_patient_by_nik($nik, $debug = "")
+ {
+ $service = "/Patient?identifier=https://fhir.kemkes.go.id/id/nik|" . $nik;
+ $resp = $this->ss_get($service);
+ if ($debug != "") {
+ echo "resp : ";
+ print_r($resp);
+ }
+ $a_resp = $this->objToArray($resp);
+ if (isset($a_resp["entry"][0]["resource"]["id"])) {
+ return $a_resp["entry"][0]["resource"]["id"];
+ }
+ return "";
+ }
+
+ function location_by_organization($organizationIhsID, $debug = "")
+ {
+ $service = "/Location?organization=" . $organizationIhsID;
+ $resp = $this->ss_get($service);
+ if ($debug != "") {
+ echo "resp : ";
+ print_r($resp);
+ }
+ $a_resp = $this->objToArray($resp);
+ return $a_resp;
+ }
+
+ function location_create(
+ $code,
+ $name,
+ $description,
+ $address,
+ $city,
+ $kodePos,
+ $administrativeCode,
+ $rt,
+ $rw,
+ $phone,
+ $type,
+ $partOf = "",
+ $email = "",
+ $fax = "",
+ $url = "",
+ $long = "",
+ $lat = ""
+ ) {
+ $this->get_organization_id();
+ $organizationID = $this->organizationID;
+ list($type_code, $type_display) = explode("^", $type);
+ $telecom = [];
+ $telecom[] = ["system" => "phone", "value" => "$phone", "use" => "work"];
+ if ($fax != "") $telecom[] = ["system" => "fax", "value" => "$fax", "use" => "work"];
+ if ($email != "") $telecom[] = ["system" => "email", "value" => "$email"];
+ if ($url != "") $telecom[] = ["system" => "url", "value" => "$url"];
+ $provCode = substr($administrativeCode, 0, 2);
+ $cityCode = substr($administrativeCode, 0, 4);
+ $districtCode = substr($administrativeCode, 0, 7);
+ $villageCode = substr($administrativeCode, 0, 10);
+
+ $data = [
+ "resourceType" => "Location",
+ "identifier" => [
+ [
+ "system" => "http://sys-ids.kemkes.go.id/location/{$organizationID}",
+ "value" => "$code",
+ ],
+ ],
+ "status" => "active",
+ "name" => "$name",
+ "description" => "$description",
+ "mode" => "instance",
+ "telecom" => $telecom,
+ "address" => [
+ "use" => "work",
+ "line" => [
+ $address,
+ ],
+ "city" => "$city",
+ "postalCode" => "$kodePos",
+ "country" => "ID",
+ "extension" => [
+ [
+ "url" =>
+ "https://fhir.kemkes.go.id/r4/StructureDefinition/administrativeCode",
+ "extension" => [
+ ["url" => "province", "valueCode" => $provCode],
+ ["url" => "city", "valueCode" => $cityCode],
+ ["url" => "district", "valueCode" => "$districtCode"],
+ ["url" => "village", "valueCode" => "$villageCode"],
+ ["url" => "rt", "valueCode" => "$rt"],
+ ["url" => "rw", "valueCode" => "$rw"],
+ ],
+ ],
+ ],
+ ],
+ "physicalType" => [
+ "coding" => [
+ [
+ "system" =>
+ "http://terminology.hl7.org/CodeSystem/location-physical-type",
+ "code" => "$type_code",
+ "display" => "$type_display",
+ ],
+ ],
+ ],
+ "position" => [
+ "longitude" => intval($long),
+ "latitude" => intval($lat),
+ "altitude" => 0,
+ ],
+ "managingOrganization" => ["reference" => "Organization/{$organizationID}"],
+ ];
+ if ($partOf != "") {
+ $data["partOf"] = [
+ "reference" => "Location/$partOf"
+ ];
+ }
+ $service = "/Location";
+ $resp = $this->ss_post($service, $data);
+ $oresp = $this->objToArray($resp);
+ if (!isset($oresp["id"])) {
+ header("Content-Type: text/plain");
+ print_r($data);
+ print_r($resp);
+ }
+ return $oresp;
+ }
+
+ function location_nonactive(
+ $ihsID
+ ) {
+ $this->get_organization_id();
+ $data = [
+ [
+ "op" => "replace",
+ "path" => "/status",
+ "value" => "inactive"
+ ]
+ ];
+
+ $service = "/Location/$ihsID";
+ $resp = $this->ss_patch($service, $data);
+ return $this->objToArray($resp);
+ }
+ function get_location($locationID)
+ {
+ }
+
+
+
+
+ function encounter_by_id($encounterID)
+ {
+ $this->get_organization_id();
+ $service = "/Encounter/$";
+ $resp = $this->ss_get($service);
+ return $this->objToArray($resp);
+ }
+ function encounter_by_subject($patientIhsID)
+ {
+ $this->get_organization_id();
+ $service = "/Encounter?subject=$patientIhsID";
+ $resp = $this->ss_get($service);
+ return $this->objToArray($resp);
+ }
+ function encounter(
+ $orderDate,
+ $patientIhsID,
+ $patientName,
+ $doctorIhsID,
+ $doctorName,
+ $locationID,
+ $locationName,
+ $labNumber,
+ $tz = "+07:00",
+ $payload_only = false
+ ) {
+ $service = "/Encounter";
+ $xdate = substr($orderDate, 0, 10) . "T" . substr($orderDate, 11) . $tz;
+ $this->get_organization_id();
+ $param = $this->encounter_param(
+ $patientIhsID,
+ $patientName,
+ $doctorIhsID,
+ $doctorName,
+ $locationID,
+ $locationName,
+ $this->organizationID,
+ $labNumber,
+ $xdate
+ );
+ $payload = json_encode($param);
+ if ($payload_only) {
+ return ["", "", $payload, ""];
+ }
+ $jresp = $this->ss_post($service, $param);
+ $resp = $this->objToArray($jresp);
+ $response = json_encode($resp);
+ if (is_array($resp) && isset($resp["id"])) {
+ $encounterResponseID = $resp["id"];
+ return [$encounterResponseID, "", $payload, $response];
+ } else {
+ return ["", $response, $payload, $response];
+ }
+ }
+ function encounter_param(
+ $patientIhs,
+ $patientName,
+ $dpjpIhs,
+ $dpjpName,
+ $locationIhs,
+ $locationName,
+ $organizationID,
+ $orderHeaderNumber,
+ $dateTime // 2022-06-14T07:00:00+07:00
+ ) {
+ if ($this->is_staging) {
+ $dpjpIhs = "N10000001";
+ $dpjpName = "Dokter Bronsig";
+ }
+ $encounterParam = [
+ "resourceType" => "Encounter",
+ "status" => "arrived",
+ "class" => [
+ "system" => "http://terminology.hl7.org/CodeSystem/v3-ActCode",
+ "code" => "AMB",
+ "display" => "ambulatory"
+ ],
+ "subject" => [
+ "reference" => "Patient/{$patientIhs}",
+ "display" => "$patientName"
+ ],
+ "participant" => [
+ [
+ "type" => [
+ [
+ "coding" => [
+ [
+ "system" => "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
+ "code" => "ATND",
+ "display" => "attender"
+ ]
+ ]
+ ]
+ ],
+ "individual" => [
+ "reference" => "Practitioner/{$dpjpIhs}",
+ "display" => "$dpjpName"
+ ]
+ ]
+ ],
+ "period" => [
+ "start" => "$dateTime",
+ ],
+ "location" => [
+ [
+ "location" => [
+ "reference" => "Location/$locationIhs",
+ "display" => "$locationName"
+ ]
+ ]
+ ],
+ "statusHistory" => [
+ [
+ "status" => "arrived",
+ "period" => [
+ "start" => $dateTime
+ ]
+ ]
+ ],
+ "serviceProvider" => [
+ "reference" => "Organization/{$organizationID}"
+ ],
+ "identifier" => [
+ [
+ "system" => "http://sys-ids.kemkes.go.id/encounter/{$organizationID}",
+ "value" => "$orderHeaderNumber"
+ ]
+ ]
+ ];
+ return $encounterParam;
+ }
+
+
+
+
+ // helper
+ function get_organization_id()
+ {
+
+ $sql = "SELECT organizationID
+ FROM {$this->dbname}.organization
+ JOIN m_branch ON organizationM_BranchID = M_BranchID AND M_BranchIsDefault = 'Y' AND M_BranchIsActive = 'Y'
+ WHERE organizationIsActive = 'Y'";
+ $qry = $this->db->query($sql);
+ if (!$qry) {
+ return;
+ }
+ $rows = $qry->result_array();
+ if (count($rows) > 0) {
+ $this->organizationID = $rows[0]["organizationID"];
+ }
+ }
+
+ function ss_patch($service, $data)
+ {
+ $token = $this->get_token();
+ $authorization = "Authorization: Bearer " . $token;
+ $xbase_url = $this->base_url;
+ $url = $xbase_url . "$service";
+ $ch = curl_init($url);
+ # Setup request to send json via POST.
+ $payload = json_encode($data);
+
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json-patch+json', $authorization));
+ # Return response instead of printing.
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ # Send request.
+ $result = curl_exec($ch);
+ curl_close($ch);
+ # Print response.
+ $data_rst = json_decode($result);
+ return $data_rst;
+ }
+
+ function get_client_key($debug = "")
+ {
+ $sql = "select * from {$this->dbname}.client where clientIsActive = 'Y'";
+ $qry = $this->db->query($sql);
+ if (!$qry) {
+ return [false, "", ""];
+ }
+ $rows = $qry->result_array();
+ if (count($rows) == 0) {
+ if ($debug != "") {
+ print_r([false, "", ""]);
+ }
+ return [false, "", ""];
+ }
+ if ($debug != "") {
+ print_r([true, $rows[0]["clientKey"], $rows[0]["clientSecret"]]);
+ }
+
+ return [true, $rows[0]["clientKey"], $rows[0]["clientSecret"]];
+ }
+
+ function reset_token()
+ {
+ $sql = "delete from {$this->dbname}.token ";
+ $qry = $this->db->query($sql);
+ if (!$qry) {
+ echo "ERR : " . $this->db->error()["message"];
+ echo " " . $this->db->last_query();
+ exit;
+ }
+ }
+
+ function put_token()
+ {
+ $auth_url = $this->base_oauth_url;
+ $url = $auth_url . "/accesstoken?grant_type=client_credentials";
+ list($status, $key, $secret) = $this->get_client_key();
+ $data = [
+ "client_id" => $key,
+ "client_secret" => $secret
+ ];
+ $ch = curl_init($url);
+ $post_data = http_build_query($data);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ $result = curl_exec($ch);
+ curl_close($ch);
+ if ($result) {
+ $token_rst = json_decode($result);
+ $sql = "select count(*) as xcount, tokenID
+ from {$this->dbname}.token
+ where
+ tokenIsActive = 'y'
+ ";
+ $qry = $this->db->query($sql);
+ if (!$qry) {
+ echo "get count token error";
+ exit;
+ }
+
+ $rst_count = $qry->row_array();
+ // print_r($token_rst);
+ if ($rst_count['xcount'] > 0) {
+ $sql = "update {$this->dbname}.token set tokenValue = ?, tokenExpired = date_add(now(), interval 50 minute)
+ where tokenID = ?";
+ $qry = $this->db->query($sql, [$token_rst->access_token, $rst_count['tokenID']]);
+ if (!$qry) {
+ $this->sys_error_db("refresh token error", $this->db->last_query());
+ exit;
+ }
+ } else {
+ $sql = "update {$this->dbname}.token set tokenIsActive = 'N' where tokenIsActive = 'Y'";
+ $qry = $this->db->query($sql);
+ if (!$qry) {
+ echo "nonactive token error";
+ exit;
+ }
+
+ $sql = "insert into {$this->dbname}.token(tokenValue,tokenExpired) values(?,date_add(now(), interval 50 minute))";
+ $qry = $this->db->query($sql, [$token_rst->access_token]);
+ if (!$qry) {
+ echo "insert token error";
+ exit;
+ }
+ }
+
+ $sql = "select tokenValue
+ from {$this->dbname}.token
+ where
+ tokenIsActive = 'Y' limit 1
+ ";
+ $qry = $this->db->query($sql);
+ if (!$qry) {
+ echo "get token error";
+ exit;
+ }
+
+ return $qry->row()->tokenValue;
+ }
+ }
+
+ function get_token()
+ {
+ $sql = "SELECT COUNT(*) as xcount, tokenValue
+ FROM {$this->dbname}.token
+ WHERE tokenIsActive = 'Y' AND NOW() < tokenExpired AND tokenValue IS NOT NULL ";
+ $qry = $this->db->query($sql);
+ $this->check_error($qry, "select token");
+
+ $data_token = $qry->row_array();
+ //print_r($data_token);
+ if ($data_token['xcount'] > 0) {
+ return $data_token['tokenValue'];
+ } else {
+ return $this->put_token();
+ }
+ }
+
+
+ function ss_post($service, $data)
+ {
+ $token = $this->get_token();
+ $authorization = "Authorization: Bearer " . $token;
+ $xbase_url = $this->base_url;
+ $url = $xbase_url . "$service";
+ $ch = curl_init($url);
+ # Setup request to send json via POST.
+ $payload = json_encode($data);
+
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $authorization));
+ # Return response instead of printing.
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ # Send request.
+ $result = curl_exec($ch);
+ curl_close($ch);
+ # Print response.
+ $data_rst = json_decode($result);
+ return $data_rst;
+ }
+ function ss_get($service, $debug = "")
+ {
+ $token = $this->get_token();
+ $authorization = "Authorization: Bearer " . $token;
+ $xbase_url = $this->base_url;
+ $url = $xbase_url . "$service";
+ $ch = curl_init($url);
+
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $authorization));
+ # Return response instead of printing.
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ # Send request.
+ $result = curl_exec($ch);
+ curl_close($ch);
+ # Print response.
+ if ($debug != "") {
+ echo "url : $url \n";
+ print_r($result);
+ }
+ $data_rst = json_decode($result);
+ return $data_rst;
+ }
+ protected function objToArray($obj)
+ {
+ if (!is_object($obj) && !is_array($obj)) {
+ return $obj;
+ }
+ foreach ($obj as $key => $value) {
+ $arr[$key] = $this->objToArray($value);
+ }
+ return $arr;
+ }
+
+ function check_error($qry, $stage)
+ {
+ if (!$qry) {
+ echo json_encode([
+ "status" => "ERR",
+ "message" => $this->db->error(),
+ "sql" => $this->db->last_query()
+ ]);
+ exit;
+ }
+ }
+}
diff --git a/application/libraries/Satusehat.php b/application/libraries/Satusehat.php
new file mode 100644
index 00000000..842bdf3d
--- /dev/null
+++ b/application/libraries/Satusehat.php
@@ -0,0 +1,244 @@
+db_onedev = $CI->load->database("default", true);
+
+ }
+
+ function clean_mysqli_connection( $dbc )
+{
+ while( mysqli_more_results($dbc) )
+ {
+ if(mysqli_next_result($dbc))
+ {
+ $result = mysqli_use_result($dbc);
+
+ if( get_class($result) == 'mysqli_stmt' )
+ {
+ mysqli_stmt_free_result($result);
+ }
+ else
+ {
+ unset($result);
+ }
+ }
+ }
+}
+
+/*function get_token(){
+ $sql = "SELECT COUNT(*) as xcount, tokenValue
+ FROM one_health.token
+ WHERE tokenIsActive = 'Y' AND NOW() < tokenExpired AND tokenValue IS NOT NULL
+ ";
+ $qry = $this->db_onedev->query($sql);
+ if (!$qry) {
+ echo "select token error";
+ exit;
+ }
+
+ $data_token = $qry->row_array();
+ //print_r($data_token);
+ if($data_token['xcount'] > 0){
+ return $data_token['tokenValue'];
+ }else{
+ return $this->putx_token();
+ }
+
+
+}*/
+
+function get_new_token(){
+
+
+ $curl = curl_init();
+
+ curl_setopt_array($curl, array(
+ CURLOPT_URL => 'https://api-satusehat-dev.dto.kemkes.go.id/oauth2/v1/accesstoken?grant_type=client_credentials',
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_ENCODING => '',
+ CURLOPT_MAXREDIRS => 10,
+ CURLOPT_TIMEOUT => 0,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+ CURLOPT_CUSTOMREQUEST => 'POST',
+ CURLOPT_POSTFIELDS => 'client_id=6PukKqO0RQqu0cKBOC8EKGcXQySfPR4aVkiVmuTgkx5xvva4&client_secret=89ZqsmY3z5W7rVscHTp9gJoAWWiAZG4A2unS3maTw3DxBFxTdaRsSeTUbD8mRN3p',
+ ));
+
+ $response = curl_exec($curl);
+
+ curl_close($curl);
+ echo $response;
+
+}
+
+function put_token(){
+ $auth_url = "https://api-satusehat-dev.dto.kemkes.go.id/oauth2/v1";
+ //API URL
+ $url = $auth_url."/accesstoken?grant_type=client_credentials";
+ //echo $url;
+
+ $data = [
+ "client_id" => "6PukKqO0RQqu0cKBOC8EKGcXQySfPR4aVkiVmuTgkx5xvva4",
+ "client_secret" => "89ZqsmY3z5W7rVscHTp9gJoAWWiAZG4A2unS3maTw3DxBFxTdaRsSeTUbD8mRN3p"
+ ];
+
+
+ $ch = curl_init($url);
+ # Setup request to send json via POST.
+
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
+ curl_setopt($ch,CURLOPT_HTTPHEADER,
+ array(
+ 'Content-Type: application/x-www-form-urlencoded'
+ )
+ );
+ # Return response instead of printing.
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ # Send request.
+ $result = curl_exec($ch);
+ curl_close($ch);
+ # Print response.
+ print_r($result);
+ //echo $token_rst->access_token;
+ if($result){
+ $token_rst = json_decode($result);
+
+ $sql = "SELECT COUNT(*) as xcount, tokenID
+ FROM one_health.token
+ WHERE
+ tokenIsActive = 'Y'
+ ";
+ $qry = $this->db_onedev->query($sql);
+ if (!$qry) {
+ echo "get count token error";
+ exit;
+ }
+
+ $rst_count = $qry->row_array();
+
+ if($rst_count['xcount'] > 0){
+ $sql = "UPDATE one_health.token SET tokenValue = ?, tokenExpired = DATE_ADD(NOW(), INTERVAL 50 MINUTE)
+ WHERE tokenID = ?";
+ $qry = $this->db_onedev->query($sql, [$token_rst->access_token,$rst_count['tokenID']]);
+ if (!$qry) {
+ $this->sys_error_db("refresh token error", $this->db_onedev->last_query());
+ exit;
+ }
+ }else{
+ $sql = "UPDATE one_health.token SET tokenIsActive = 'N' WHERE tokenIsActive = 'Y'";
+ $qry = $this->db_onedev->query($sql);
+ if (!$qry) {
+ echo "nonactive token error";
+ exit;
+ }
+
+ $sql = "INSERT INTO one_health.token(tokenValue,tokenExpired) VALUES(?,DATE_ADD(NOW(), INTERVAL 50 MINUTE))";
+ $qry = $this->db_onedev->query($sql, [$token_rst->access_token]);
+ if (!$qry) {
+ echo "insert token error";
+ exit;
+ }
+ }
+
+ $sql = "SELECT tokenValue
+ FROM one_health.token
+ WHERE
+ tokenIsActive = 'Y' LIMIT 1
+ ";
+ $qry = $this->db_onedev->query($sql);
+ if (!$qry) {
+ echo "get token error";
+ exit;
+ }
+
+ return $qry->row()->tokenValue;
+ }
+
+
+}
+
+/*function search_practicioner_by_nik($nik){
+ $sql = "SELECT tokenValue
+ FROM one_health.token
+ WHERE
+ tokenIsActive = 'Y' LIMIT 1
+ ";
+ $qry = $this->db_onedev->query($sql);
+ if (!$qry) {
+ echo "get token error";
+ exit;
+ }
+
+ $token = $qry->row()->tokenValue;
+
+ $authorization = "Authorization: Bearer ".$token;
+ //API URL
+ $url = $this->xbase_url."/Practitioner?identifier=https://fhir.kemkes.go.id/id/nik|".$nik;
+ //echo $url;
+
+
+ $ch = curl_init($url);
+ # Setup request to send json via POST.
+ //$payload = json_encode($data);
+
+ //curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
+ # Return response instead of printing.
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ # Send request.
+ $result = curl_exec($ch);
+ curl_close($ch);
+ # Print response.
+ $data_rst = json_decode($result);
+ print_r($result);
+
+ return $data_rst;
+}*/
+
+function gen_uuid() {
+ return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
+ // 32 bits for "time_low"
+ mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
+
+ // 16 bits for "time_mid"
+ mt_rand( 0, 0xffff ),
+
+ // 16 bits for "time_hi_and_version",
+ // four most significant bits holds version number 4
+ mt_rand( 0, 0x0fff ) | 0x4000,
+
+ // 16 bits, 8 bits for "clk_seq_hi_res",
+ // 8 bits for "clk_seq_low",
+ // two most significant bits holds zero and one for variant DCE1.1
+ mt_rand( 0, 0x3fff ) | 0x8000,
+
+ // 48 bits for "node"
+ mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
+ );
+}
+
+protected function objToArray($obj)
+ {
+ // Not an object or array
+ if (!is_object($obj) && !is_array($obj)) {
+ return $obj;
+ }
+
+ // Parse array
+ foreach ($obj as $key => $value) {
+ $arr[$key] = $this->objToArray($value);
+ }
+
+ // Return parsed array
+ return $arr;
+ }
+}
+
+
diff --git a/application/libraries/Soresultlog.php b/application/libraries/Soresultlog.php
new file mode 100644
index 00000000..e50fdaff
--- /dev/null
+++ b/application/libraries/Soresultlog.php
@@ -0,0 +1,69 @@
+db_onedev = $CI->load->database("default", true);
+ $this->db_smartone = $CI->load->database("default", true);
+ }
+
+ function clean_mysqli_connection($dbc)
+ {
+ while (mysqli_more_results($dbc)) {
+ if (mysqli_next_result($dbc)) {
+ $result = mysqli_use_result($dbc);
+
+ if (get_class($result) == 'mysqli_stmt') {
+ mysqli_stmt_free_result($result);
+ } else {
+ unset($result);
+ }
+ }
+ }
+ }
+
+ public function step_action($act,$re_id,$userid)
+ {
+ //$CI = &get_instance();
+ //$this->db = $CI->load->database("one", true);
+
+ $sql = "INSERT INTO so_reactionlog(
+ So_REActionLogDate,
+ So_REActionLogSo_ResultEntryID,
+ So_REActionLogAction,
+ So_REActionLogUserID
+ )
+ VALUES(
+ NOW(),?,?,?
+ )";
+ $qry = $this->db_onedev->query($sql, array($re_id,$act,$userid));
+ if (!$qry) {
+ return array(false, print_r($this->db_onedev->error(), true));
+ }else
+ return array(true);
+ }
+
+ public function log_result($data_json,$re_id,$userid)
+ {
+ //$CI = &get_instance();
+ //$this->db = $CI->load->database("one", true);
+ //echo $re_id;
+ $sql = "INSERT INTO cpone_log.log_resultentry_so(
+ Log_ResultEntrySoDate,
+ Log_ResultEntrySoReID,
+ Log_ResultEntrySoJSON,
+ Log_ResultEntrySoUserID
+ )
+ VALUES(
+ NOW(),?,?,?
+ )";
+ $qry = $this->db_onedev->query($sql, array($re_id,$data_json,$userid));
+ if (!$qry) {
+ return array(false, print_r($this->db_onedev->error(), true));
+ }else
+ return array(true);
+ }
+}
diff --git a/application/libraries/SsPriceMou.php b/application/libraries/SsPriceMou.php
new file mode 100644
index 00000000..4d29d4ce
--- /dev/null
+++ b/application/libraries/SsPriceMou.php
@@ -0,0 +1,547 @@
+db = $CI->load->database("onedev",true);
+
+ $sql = "select * from m_mou where M_MouID = ?";
+ $qry = $this->db->query($sql, array($mouID));
+ if (! $qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $rows = $qry->result_array();
+ if (count($rows) == 0 ) {
+ return array(false, "MOU ID : $mouID not found");
+ }
+ $companyID = $rows[0]["M_MouM_CompanyID"];
+
+ $sql = "select distinct T_PriceM_MouID, T_TestID, T_TestName, 'N' IsFromPanel, Nat_TestID,
+ T_PriceT_TestID, T_PriceIsCito, T_PriceM_CompanyID, T_PriceM_MouID,
+ T_PricePriority, T_PriceAmount, T_PriceDisc, T_PriceDiscRp, T_PriceSubTotal,
+ T_PriceOther, T_PriceTotal, T_TestForceSell, 'N' is_packet, 0 packet_id,
+ 'PX' px_type, '[]' nat_test, '[]' child_test, 'N' IsFavourite,
+ Nat_TestNat_TestTypeID, T_TestSasCode, $mouID Ss_PriceMouM_MouID
+ from t_price
+ join t_test on T_PriceT_TestID = T_TestID
+ and T_PriceIsActive = 'Y' and T_TestIsActive = 'Y'
+ and T_TestIsPrice = 'Y'
+ join nat_test on T_TestNat_TestID = Nat_TestID
+ and Nat_TestIsActive = 'Y' and Nat_TestNat_TestTypeID <> 5
+ where T_PriceM_MouID = ?
+ and length(T_TestSasCode) = 8 ";
+ $qry = $this->db->query($sql, array($mouID));
+
+ if (! $qry ) {
+ return array(false, "Regional select t_price " . print_r($this->db->error(),true));
+ }
+ $rows = $qry->result_array();
+ $flag_error = false;
+ foreach($rows as $idx => $r) {
+ $nat_testType = $r["Nat_TestNat_TestTypeID"];
+ switch($nat_testType) {
+ case 1: //Single
+ $rows[$idx]['nat_test'] = '[' . $r['Nat_TestID'] . ']';
+ break;
+ case 3: //Multi
+ case 4: //Panel
+ $sasCode = $r["T_TestSasCode"] . '%';
+ $sql = "select T_TestNat_TestID
+ from t_test
+ where T_TestIsResult = 'Y'
+ and T_TestSasCode like ?
+ and T_TestIsActive = 'Y'";
+ $qry = $this->db->query($sql,array($sasCode));
+ if (!$qry ) {
+ return array(false, "Regional " . print_r($this->db->error(),true));
+ }
+ $nt_rows = $qry->result_array();
+ $t_rows = array($r["Nat_TestID"]);
+ foreach($nt_rows as $nr) {
+ $t_rows[] = $nr["T_TestNat_TestID"];
+ }
+ $rows[$idx]['nat_test'] = "[" . join(",",$t_rows) . "]";
+ break;
+ default :
+ $rows[$idx]['nat_test'] = '[' . $r['Nat_TestID'] . ']';
+ break;
+ }
+ unset($rows[$idx]["Nat_TestNat_TestTypeID"]);
+ unset($rows[$idx]["T_TestSasCode"]);
+ }
+ //Test Profile
+ // wip profile
+ $sql = "select distinct $mouID T_PriceM_MouID, T_TestID, T_TestName, 'N' IsFromPanel, Nat_TestID,
+ T_TestID T_PriceT_TestID, 'N' T_PriceIsCito, $companyID T_PriceM_CompanyID, $mouID T_PriceM_MouID,
+ 0 T_PricePriority, 0 T_PriceAmount, 0 T_PriceDisc, 0 T_PriceDiscRp, 0 T_PriceSubTotal,
+ 0 T_PriceOther, 0 T_PriceTotal, T_TestForceSell, 'N' is_packet, 0 packet_id,
+ 'PXR' px_type, '[]' nat_test, '[]' child_test, 'N' IsFavourite,
+ Nat_TestNat_TestTypeID, T_TestSasCode, $mouID Ss_PriceMouM_MouID
+ from t_test
+ join nat_test on T_TestNat_TestID = Nat_TestID
+ and Nat_TestIsActive = 'Y' and Nat_TestNat_TestTypeID = 5
+ where length(T_TestSasCode) = 8 ";
+ $qry = $this->db->query($sql, array($mouID));
+ if (! $qry ) {
+ return array(false, "Regional " . print_r($this->db->error(),true));
+ }
+ $p_rows = $qry->result_array();
+
+ $sql = "select distinct substr(T_TestSasCode,1,8) parentCode, T_PriceM_MouID, T_TestID, T_TestName, 'N' IsFromPanel, Nat_TestID,
+ T_PriceT_TestID, T_PriceIsCito, T_PriceM_CompanyID, T_PriceM_MouID,
+ T_PricePriority, T_PriceAmount, T_PriceDisc, T_PriceDiscRp, T_PriceSubTotal,
+ T_PriceOther, T_PriceTotal, T_TestForceSell, 'N' is_packet, 0 packet_id,
+ 'PX' px_type, concat('[', T_TestNat_TestID , ']') nat_test, '[]' child_test, 'N' IsFavourite,
+ Nat_TestNat_TestTypeID, T_TestSasCode,T_TestIsResult, T_TestCode
+ from t_price
+ join t_test on T_PriceT_TestID = T_TestID
+ and T_PriceIsActive = 'Y' and T_TestIsActive = 'Y'
+ and T_TestIsPrice = 'Y'
+ and T_PriceIsCito = 'N'
+ and length(T_TestSasCode) = 10
+ join nat_test on T_TestNat_TestID = Nat_TestID
+ and Nat_TestIsActive = 'Y'
+ where T_PriceM_MouID = ? ";
+ $qry = $this->db->query($sql,array($mouID));
+ if (!$qry ) {
+ return array(false, "Regional child test " . print_r($this->db->error(),true));
+ }
+ $xrows = $qry->result_array();
+ $arr_child = array();
+ $p_codes = "'0'";
+ foreach($xrows as $r ) {
+ $pCode = $r["parentCode"];
+ if ( ! isset($arr_child[$pCode])) {
+ $arr_child[$pCode] = array();
+ }
+ $cCode = $r["T_TestSasCode"];
+ $p_codes .= ", '$cCode'";
+ unset($r["parentCode"]);
+ $arr_child[$pCode][] = $r;
+ }
+ $sql = "select substr(T_TestSasCode,1,8) parentCode,
+ group_concat(distinct T_TestNat_TestID) nat
+ from t_test
+ where ( T_TestIsResult = 'Y' or T_TestIsPrice = 'Y' )
+ and T_TestSasCode in ( $p_codes )
+ and T_TestIsActive = 'Y'
+ group by parentCode";
+ $qry = $this->db->query($sql,array($mouID));
+ if (!$qry ) {
+ return array(false, "Regional " . print_r($this->db->error(),true));
+ }
+ $xrows = $qry->result_array();
+ $arr_nat = array();
+ foreach($xrows as $r ) {
+ $pCode = $r["parentCode"];
+ //if ( ! isset($arr_nat[$pCode])) {
+ // $arr_nat[$pCode] = array();
+ //}
+ $arr_nat[$pCode] = $r["nat"];
+ }
+ $flag_error = false;
+ foreach($p_rows as $idx => $r) {
+ $T_TestName= $r["T_TestName"] ;
+ $sasCode = $r["T_TestSasCode"];
+ if ( isset($arr_child[$sasCode]) ) {
+ $the_childs = $arr_child[$sasCode];
+ $p_rows[$idx]['child_test'] = json_encode($the_childs,true);
+ if ( isset($arr_nat[$sasCode] )) {
+ $p_rows[$idx]['nat_test'] = "[" . $arr_nat[$sasCode] . "]";
+ }
+ unset($p_rows[$idx]["Nat_TestNat_TestTypeID"]);
+ unset($p_rows[$idx]["T_TestSasCode"]);
+ } else {
+ unset($p_rows[$idx]);
+ }
+ }
+ //Paket Panel / Profile
+ $sql = "select distinct $mouID T_PriceM_MouID, T_PacketID T_TestID, T_PacketName T_TestName, 'N' IsFromPanel, 0 Nat_TestID,
+ T_PacketID T_PriceT_TestID, 'N' T_PriceIsCito, $companyID T_PriceM_CompanyID, $mouID T_PriceM_MouID,
+ 0 T_PricePriority, T_PacketOriginalBruto T_PriceAmount, 0 T_PriceDisc,
+ (T_PacketOriginalBruto - T_PacketPrice) T_PriceDiscRp, 0 T_PriceSubTotal,
+ 0 T_PriceOther, T_PacketPrice T_PriceTotal, 'Y' T_TestForceSell, 'Y' is_packet, T_PacketID packet_id,
+ T_PacketType px_type, '[]' nat_test, '[]' child_test, 'N' IsFavourite,
+ $mouID Ss_PriceMouM_MouID
+ from
+ t_packet
+ where
+ T_PacketIsActive = 'Y'
+ and T_PacketM_MouID = ?";
+
+ $qry = $this->db->query($sql, array($mouID));
+ if (! $qry ) {
+ return array(false, "Regional " . print_r($this->db->error(),true));
+ }
+ $pn_rows = $qry->result_array();
+ foreach($pn_rows as $idx => $pnr) {
+ $packetID = $pnr["packet_id"];
+ //child test
+ $sql = "select distinct $mouID T_PriceM_MouID, T_TestID, T_TestName, 'N' IsFromPanel, Nat_TestID,
+ T_TestID T_PriceT_TestID, 'N' T_PriceIsCito, $companyID T_PriceM_CompanyID,
+ $mouID T_PriceM_MouID, 0 T_PricePriority, T_PacketDetailPriceAmount T_PriceAmount,
+ T_PacketDetailPriceDisc T_PriceDisc, T_PacketDetailPriceDiscRp T_PriceDiscRp, T_PacketDetailPriceSubTotal T_PriceSubTotal,
+ 0 T_PriceOther, T_PacketDetailPrice T_PriceTotal,
+ 'Y' T_TestForceSell, 'N' is_packet, 0 packet_id,
+ 'PX' px_type, concat('[', T_TestNat_TestID , ']') nat_test, '[]' child_test, 'N' IsFavourite, T_TestSasCode
+ from t_packetdetail
+ join t_test on T_PacketDetailT_TestID = T_TestID
+ and T_PacketDetailIsActive = 'Y' and T_TestIsActive = 'Y'
+ and T_PacketDetailT_PacketID = ?
+ join nat_test on T_TestNat_TestID = Nat_TestID
+ and Nat_TestIsActive = 'Y'";
+ $qry = $this->db->query($sql,array($packetID));
+ if (!$qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $ct_rows = $qry->result_array();
+ $p_nat_test = array();
+ foreach($ct_rows as $ct_idx => $cr) {
+ $sasCode = $cr["T_TestSasCode"] . '%';
+ $sql = "select distinct T_TestNat_TestID
+ from t_test
+ where T_TestSasCode like ?
+ and T_TestIsActive = 'Y'";
+ $qry = $this->db->query($sql,array($sasCode));
+ if (!$qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $nt_rows = $qry->result_array();
+ $t_rows = array();
+ foreach($nt_rows as $nr) {
+ $t_rows[] = intval( $nr["T_TestNat_TestID"]);
+ $p_nat_test[]= intval( $nr["T_TestNat_TestID"]);
+ }
+ $ct_rows[$ct_idx]['nat_test'] = json_encode($t_rows,JSON_NUMERIC_CHECK);
+ }
+ if (count($ct_rows) > 0 ) {
+ $x_arr = array();
+ foreach($ct_rows as $x_cr) {
+ $x_arr[] = $x_cr;
+ }
+ $pn_rows[$idx]['child_test'] = json_encode($x_arr,true);
+ $pn_rows[$idx]['nat_test'] = json_encode($p_nat_test,true);
+ }
+ unset($pn_rows[$idx]["Nat_TestNat_TestTypeID"]);
+ unset($pn_rows[$idx]["T_TestSasCode"]);
+ }
+
+ $rows = array_merge($rows,$p_rows, $pn_rows);
+ $qry = $this->db->query("delete from ss_price_mou where Ss_PriceMouM_MouID=?", array($mouID));
+ if ( ! $qry ) {
+ return array(false, "Regional " . print_r($this->db->error(),true));
+ }
+ $qry = $this->db->insert_batch("ss_price_mou", $rows);
+ if ( ! $qry ) {
+ return array(false, "Regional " . print_r($this->db->error(),true));
+ }
+ return array(true, "OK");
+ }
+ public function edit($mouID,$testID,$cito) {
+ $CI =& get_instance();
+ $this->db = $CI->load->database("onedev",true);
+
+ $sql = "select * from t_test where T_TestID = ? ";
+ $qry = $this->db->query($sql, array($testID));
+ if (! $qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $rows = $qry->result_array();
+ if (count($rows) == 0 ) {
+ return array(false, "No Test $testID found");
+ }
+ $sasCode = $rows[0]["T_TestSasCode"];
+ if ( strlen($sasCode) == 8 ) {
+ $flagProfile = false;
+ } else {
+ $flagProfile = true;
+ }
+
+ $sql = "select * from m_mou where M_MouID = ?";
+ $qry = $this->db->query($sql, array($mouID));
+ if (! $qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $rows = $qry->result_array();
+ if (count($rows) == 0 ) {
+ return array(false, "No MOU $mouID found");
+ }
+ $mouName = $rows[0]["M_MouName"];
+ $companyID = $rows[0]["M_MouM_CompanyID"];
+
+ $sql = "select distinct T_PriceM_MouID, T_TestID, T_TestName, 'N' IsFromPanel, Nat_TestID,
+ T_PriceT_TestID, T_PriceIsCito, T_PriceM_CompanyID, T_PriceM_MouID,
+ T_PricePriority, T_PriceAmount, T_PriceDisc, T_PriceDiscRp, T_PriceSubTotal,
+ T_PriceOther, T_PriceTotal, T_TestForceSell, 'N' is_packet, 0 packet_id,
+ 'PX' px_type, '[]' nat_test, '[]' child_test, 'N' IsFavourite,
+ Nat_TestNat_TestTypeID, T_TestSasCode, $mouID Ss_PriceMouM_MouID
+ from t_price
+ join t_test on T_PriceT_TestID = T_TestID and T_TestID = ?
+ and T_PriceIsActive = 'Y' and T_TestIsActive = 'Y'
+ and T_TestIsPrice = 'Y' and T_PriceIsCito = ?
+ join nat_test on T_TestNat_TestID = Nat_TestID
+ and Nat_TestIsActive = 'Y' and Nat_TestNat_TestTypeID <> 5
+ where T_PriceM_MouID = ?";
+ $qry = $this->db->query($sql, array($testID, $cito, $mouID));
+ if (! $qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $rows = $qry->result_array();
+
+ foreach($rows as $idx => $r) {
+ $nat_testType = $r["Nat_TestNat_TestTypeID"];
+ switch($nat_testType) {
+ case 1: //Single
+ $rows[$idx]['nat_test'] = '[' . $r['Nat_TestID'] . ']';
+ break;
+ case 3: //Multi
+ case 4: //Panel
+ $sasCode = $r["T_TestSasCode"] . '%';
+ $sql = "select T_TestNat_TestID
+ from t_test
+ where T_TestIsResult = 'Y'
+ and T_TestSasCode like ?
+ and T_TestIsActive = 'Y'";
+ $qry = $this->db->query($sql,array($sasCode));
+ if (!$qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $nt_rows = $qry->result_array();
+ $t_rows = array($r["Nat_TestID"]);
+ foreach($nt_rows as $nr) {
+ $t_rows[] = $nr["T_TestNat_TestID"];
+ }
+ $rows[$idx]['nat_test'] = "[" . join(",",$t_rows) . "]";
+ break;
+ default :
+ $rows[$idx]['nat_test'] = '[' . $r['Nat_TestID'] . ']';
+ break;
+ }
+ unset($rows[$idx]["Nat_TestNat_TestTypeID"]);
+ }
+ if ( count($rows) > 0 ) {
+ $r = $rows[0];
+ unset($r["T_TestSasCode"]);
+ $this->db->where("T_PriceM_MouID", $r["T_PriceM_MouID"]);
+ $this->db->where("T_TestID", $r["T_TestID"]);
+ $this->db->where("T_PriceIsCito", $r["T_PriceIsCito"]);
+ $qry = $this->db->update("ss_price_mou",$r);
+ if (! $qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ }
+ $sasCode = substr($sasCode,0,8);
+ foreach($rows as $idx => $r ) {
+ if ( strlen($r["T_TestSasCode"]) > 8 ) {
+ unset($rows[$idx]);
+ } else {
+ unset($rows[$idx]["T_TestSasCode"]);
+ }
+ }
+ if ($cito == 'Y' ) {
+ return array(true,"OK",$rows);
+ }
+ // for non cito
+ if($flagProfile ) {
+ //wip profile
+ $sql = "select distinct $mouID T_PriceM_MouID, T_TestID, T_TestName, 'N' IsFromPanel, Nat_TestID,
+ T_TestID T_PriceT_TestID, 'N' T_PriceIsCito, $companyID T_PriceM_CompanyID, $mouID T_PriceM_MouID,
+ 0 T_PricePriority, 0 T_PriceAmount, 0 T_PriceDisc, 0 T_PriceDiscRp, 0 T_PriceSubTotal,
+ 0 T_PriceOther, 0 T_PriceTotal, T_TestForceSell, 'N' is_packet, 0 packet_id,
+ 'PXR' px_type, '[]' nat_test, '[]' child_test, 'N' IsFavourite,
+ Nat_TestNat_TestTypeID, T_TestSasCode, $mouID Ss_PriceMouM_MouID
+ from t_test
+ join nat_test on T_TestNat_TestID = Nat_TestID and T_TestSasCode = ?
+ and Nat_TestIsActive = 'Y' and Nat_TestNat_TestTypeID = 5
+ where length(T_TestSasCode) = 8 ";
+ $qry = $this->db->query($sql, array($sasCode));
+
+ if (! $qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $p_rows = $qry->result_array();
+
+ $sasCodeLike = $sasCode . "%";
+ $sql = "select distinct substr(T_TestSasCode,1,8) parentCode, T_PriceM_MouID, T_TestID, T_TestName, 'N' IsFromPanel, Nat_TestID,
+ T_PriceT_TestID, T_PriceIsCito, T_PriceM_CompanyID, T_PriceM_MouID,
+ T_PricePriority, T_PriceAmount, T_PriceDisc, T_PriceDiscRp, T_PriceSubTotal,
+ T_PriceOther, T_PriceTotal, T_TestForceSell, 'N' is_packet, 0 packet_id,
+ 'PX' px_type, concat('[', T_TestNat_TestID , ']') nat_test, '[]' child_test, 'N' IsFavourite,
+ Nat_TestNat_TestTypeID, T_TestSasCode,T_TestIsResult, T_TestCode
+ from t_price
+ join t_test on T_PriceT_TestID = T_TestID
+ and T_PriceIsActive = 'Y' and T_TestIsActive = 'Y'
+ and T_TestIsPrice = 'Y' and T_PriceIsCito = 'N'
+ and T_TestSasCode like ?
+ join nat_test on T_TestNat_TestID = Nat_TestID
+ and Nat_TestIsActive = 'Y'
+ where T_PriceM_MouID = ? ";
+ $qry = $this->db->query($sql,array($sasCodeLike,$mouID));
+ if (!$qry ) {
+ return array(false, "Regional child_test " . print_r($this->db->error(),true));
+ }
+ $xrows = $qry->result_array();
+ $arr_child = array();
+ $p_codes = "'0'";
+ foreach($xrows as $r ) {
+ $pCode = $r["parentCode"];
+ if ( ! isset($arr_child[$pCode])) {
+ $arr_child[$pCode] = array();
+ }
+ $cCode = $r["T_TestSasCode"];
+ $p_codes .= ", '$cCode'";
+ unset($r["parentCode"]);
+ $arr_child[$pCode][] = $r;
+ }
+
+ $sql = "select substr(T_TestSasCode,1,8) parentCode,
+ group_concat(distinct T_TestNat_TestID) nat
+ from t_test
+ where ( T_TestIsResult = 'Y' or T_TestIsPrice = 'Y' )
+ and T_TestSasCode in ( $p_codes )
+ and T_TestIsActive = 'Y'
+ group by parentCode";
+ $qry = $this->db->query($sql,array($mouID));
+ if (!$qry ) {
+ return array(false, "Regional nat_test " . print_r($this->db->error(),true));
+ }
+ $xrows = $qry->result_array();
+ $arr_nat = array();
+ foreach($xrows as $r ) {
+ $pCode = $r["parentCode"];
+ //if ( ! isset($arr_nat[$pCode])) {
+ // $arr_nat[$pCode] = array();
+ //}
+ $arr_nat[$pCode] = $r["nat"];
+ }
+
+ $flag_error = false;
+ foreach($p_rows as $idx => $r) {
+ $T_TestName= $r["T_TestName"] ;
+ $sasCode = $r["T_TestSasCode"];
+ if ( isset($arr_child[$sasCode]) ) {
+ $the_childs = $arr_child[$sasCode];
+ $p_rows[$idx]['child_test'] = json_encode($the_childs,true);
+ if ( isset($arr_nat[$sasCode] )) {
+ $p_rows[$idx]['nat_test'] = "[" . $arr_nat[$sasCode] . "]";
+ }
+ unset($p_rows[$idx]["Nat_TestNat_TestTypeID"]);
+ unset($p_rows[$idx]["T_TestSasCode"]);
+ } else {
+ unset($p_rows[$idx]);
+ }
+ }
+
+ foreach($p_rows as $r) {
+ $this->db->where("T_PriceM_MouID", $r["T_PriceM_MouID"]);
+ $this->db->where("T_TestID", $r["T_TestID"]);
+ $this->db->where("T_PriceIsCito", $r["T_PriceIsCito"]);
+ $qry = $this->db->update("ss_price_mou",$r);
+ if (! $qry ) {
+ return array(false, "Err Update Ss_priceMou " . print_r($this->db->error(),true));
+ }
+ }
+ $rows = array_merge($rows,$p_rows);
+ }
+ //Update Panel yang mengandung Test
+ $sql = "select
+ distinct T_PacketDetailT_PacketID
+ from
+ t_packetdetail
+ where T_PacketDetailIsActive = 'Y'
+ and T_PacketDetailT_TestID = ?";
+ $qry = $this->db->query($sql, array($testID));
+ if (!$qry) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $xrows = $qry->result_array();
+ $packet_ids = "0";
+ foreach($xrows as $r ) {
+ $packet_ids .= "," . $r["T_PacketDetailT_PacketID"];
+ }
+
+ $sql = "select distinct $mouID T_PriceM_MouID, T_PacketID T_TestID, T_PacketName T_TestName, 'N' IsFromPanel, 0 Nat_TestID,
+ T_PacketID T_PriceT_TestID, 'N' T_PriceIsCito, $companyID T_PriceM_CompanyID, $mouID T_PriceM_MouID,
+ 0 T_PricePriority, T_PacketOriginalBruto T_PriceAmount, 0 T_PriceDisc,
+ (T_PacketOriginalBruto - T_PacketPrice) T_PriceDiscRp, 0 T_PriceSubTotal,
+ 0 T_PriceOther, T_PacketPrice T_PriceTotal, 'Y' T_TestForceSell, 'Y' is_packet, T_PacketID packet_id,
+ T_PacketType px_type, '[]' nat_test, '[]' child_test, 'N' IsFavourite,
+ $mouID Ss_PriceMouM_MouID
+ from
+ t_packet
+ where
+ T_PacketIsActive = 'Y' and T_PacketID in ( $packet_ids )
+ and T_PacketM_MouID = ?";
+
+ $qry = $this->db->query($sql, array($mouID));
+ if (! $qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $pn_rows = $qry->result_array();
+ foreach($pn_rows as $idx => $pnr) {
+ $packetID = $pnr["packet_id"];
+ //child test
+ $sql = "select $mouID T_PriceM_MouID, T_TestID, T_TestName, 'N' IsFromPanel, Nat_TestID,
+ T_TestID T_PriceT_TestID, 'N' T_PriceIsCito, $companyID T_PriceM_CompanyID,
+ $mouID T_PriceM_MouID, 0 T_PricePriority, T_PacketDetailPriceAmount T_PriceAmount,
+ T_PacketDetailPriceDisc T_PriceDisc, T_PacketDetailPriceDiscRp T_PriceDiscRp, T_PacketDetailPriceSubTotal T_PriceSubTotal,
+ 0 T_PriceOther, T_PacketDetailPrice T_PriceTotal,
+ 'Y' T_TestForceSell, 'N' is_packet, 0 packet_id,
+ 'PX' px_type, '[]' nat_test, '[]' child_test, 'N' IsFavourite, T_TestSasCode
+ from t_packetdetail
+ join t_test on T_PacketDetailT_TestID = T_TestID
+ and T_PacketDetailIsActive = 'Y' and T_TestIsActive = 'Y'
+ and T_PacketDetailT_PacketID = ?
+ join nat_test on T_TestNat_TestID = Nat_TestID
+ and Nat_TestIsActive = 'Y'
+";
+ $qry = $this->db->query($sql,array($packetID));
+ if (!$qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $ct_rows = $qry->result_array();
+ $p_nat_test = array();
+ foreach($ct_rows as $ct_idx => $cr) {
+ $sasCode = $cr["T_TestSasCode"] . '%';
+ $sql = "select distinct T_TestNat_TestID
+ from t_test
+ where T_TestSasCode like ?
+ and T_TestIsActive = 'Y'";
+ $qry = $this->db->query($sql,array($sasCode));
+ if (!$qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ $nt_rows = $qry->result_array();
+ $t_rows = array();
+ foreach($nt_rows as $nr) {
+ $t_rows[] = intval( $nr["T_TestNat_TestID"]);
+ $p_nat_test[]= intval( $nr["T_TestNat_TestID"]);
+ }
+ $ct_rows[$ct_idx]['nat_test'] = json_encode($t_rows,JSON_NUMERIC_CHECK);
+ }
+ if (count($ct_rows) > 0 ) {
+ $x_arr = array();
+ foreach($ct_rows as $x_cr) {
+ $x_arr[] = $x_cr;
+ }
+ $pn_rows[$idx]['child_test'] = json_encode($x_arr,true);
+ $pn_rows[$idx]['nat_test'] = json_encode($p_nat_test,true);
+ }
+ unset($pn_rows[$idx]["Nat_TestNat_TestTypeID"]);
+ unset($pn_rows[$idx]["T_TestSasCode"]);
+ }
+ foreach($pn_rows as $r ) {
+ $this->db->where("T_PriceM_MouID", $r["T_PriceM_MouID"]);
+ $this->db->where("T_TestID", $r["T_TestID"]);
+ $this->db->where("T_PriceIsCito", $r["T_PriceIsCito"]);
+ $qry = $this->db->update("ss_price_mou",$r);
+ if (! $qry ) {
+ return array(false, print_r($this->db->error(),true));
+ }
+ }
+ $rows = array_merge($rows,$pn_rows);
+ return array(true,"OK",$rows);
+ }
+}
diff --git a/application/libraries/SsPriceMouPx.php b/application/libraries/SsPriceMouPx.php
new file mode 100644
index 00000000..25407c34
--- /dev/null
+++ b/application/libraries/SsPriceMouPx.php
@@ -0,0 +1,52 @@
+db = $CI->load->database("onedev",true);
+
+ $sql = "select * from ss_price_mou where Ss_PriceMouM_MouID = ? and px_type in ('PR','PXR')";
+ $qry = $this->db->query($sql, array($mouID));
+ if ( ! $qry ) {
+ return array(false, "Ss Price Mou " . print_r($this->db->error(),true));
+ }
+ $rows = $qry->result_array();
+ $sql ="delete from ss_price_mou_px where Ss_PriceMouPxSs_PriceMouID in ( select Ss_PriceMouID from ss_price_mou
+ where Ss_PriceMouM_MouID = ? )";
+ $qry = $this->db->query($sql, array($mouID));
+ if ( ! $qry ) {
+ return array(false, "Clear Ss Price Mou Px" . print_r($this->db->error(),true));
+ }
+ $a_data = array();
+ foreach($rows as $r) {
+ $j_ct = $r["child_test"];
+ $ct = json_decode($j_ct,true);
+ foreach($ct as $c) {
+ $a_data[] = array(
+ "Ss_PriceMouPxM_MouID" => $r["Ss_PriceMouM_MouID"],
+ "Ss_PriceMouPxSs_PriceMouID" => $r["Ss_PriceMouID"],
+ "Ss_PriceMouPxT_TestID" => $c["T_TestID"],
+ "Ss_PriceMouPxT_TestName" => $c["T_TestName"],
+ "Ss_PriceMouPxT_PriceIsCito" => $c["T_PriceIsCito"],
+ "Ss_PriceMouPxT_PriceM_CompanyID" => $c["T_PriceM_CompanyID"],
+ "Ss_PriceMouPxT_PricePriority" => $c["T_PricePriority"],
+ "Ss_PriceMouPxT_PriceAmount" => $c["T_PriceAmount"],
+ "Ss_PriceMouPxT_PriceDisc" => $c["T_PriceDisc"],
+ "Ss_PriceMouPxT_PriceDiscRp" => $c["T_PriceDiscRp"],
+ "Ss_PriceMouPxT_PriceSubTotal" => $c["T_PriceSubTotal"],
+ "Ss_PriceMouPxT_PriceOther" => $c["T_PriceOther"],
+ "Ss_PriceMouPxT_PriceTotal" => $c["T_PriceTotal"],
+ "Ss_PriceMouPxT_TestForceSell" => $c["T_TestForSell"],
+ "nat_test" => $c["nat_test"]
+ );
+ }
+ }
+ $qry = $this->db->insert_batch("ss_price_mou_px",$a_data);
+ if ( ! $qry ) {
+ return array(false, "Batch Ss Price Mou Px" . print_r($this->db->error(),true));
+ }
+
+ return array(true, "");
+ }
+}
diff --git a/application/libraries/Txbranchstatus-cabang.php b/application/libraries/Txbranchstatus-cabang.php
new file mode 100644
index 00000000..e6e9f469
--- /dev/null
+++ b/application/libraries/Txbranchstatus-cabang.php
@@ -0,0 +1,249 @@
+db = $CI->load->database("onedev",true);
+ $s_ids = join(",",$ids);
+ $sql = "select T_OrderDetailT_TestID, T_OrderDetailT_OrderHeaderID
+ from
+ t_orderdetail
+ where T_OrderDetailID in ($s_ids) ";
+ $qry = $this->db->query($sql);
+ $incomingRefID = 0;
+ $s_detail_ids = "0";
+ $s_child_ids = "0";
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows) > 0 ) {
+ $headerID = $rows[0]["T_OrderDetailT_OrderHeaderID"];
+ $s_test = "0";
+ foreach($rows as $r) {
+ $s_test .= "," . $r["T_OrderDetailT_TestID"];
+ }
+ $sql = "select incomingRefDetailID , incomingRefDetailIncomingRefID
+ from incoming_ref_detail
+ where incomingRefDetailNewT_OrderHeaderID = ?
+ and incomingRefDetailT_TestID in ($s_test) ";
+ $qryd = $this->db->query($sql, array($headerID));
+ $flag_found = false;
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefDetailIncomingRefID"];
+ foreach($rowsd as $r) {
+ $s_detail_ids .= "," . $r["incomingRefDetailID"];
+ }
+ }
+ }
+ //check child
+ if(! $flag_found ) {
+ $sql = "select incomingRefChildID , incomingRefChildIncomingRefID
+ from incoming_ref_child
+ where incomingRefChildNewT_OrderHeaderID = ?
+ and incomingRefChildT_TestID in ($s_test) ";
+ $qryd = $this->db->query($sql, array($headerID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefChildIncomingRefID"];
+ foreach($rowsd as $r) {
+ $s_child_ids .= "," . $r["incomingRefChildID"];
+ }
+ }
+ }
+ }
+ }
+ }
+ if ($s_detail_ids == "0" && $s_child_ids == "0" ) {
+ return false;
+ }
+ $sql = "select M_BranchID, M_BranchIPAddress
+ from m_branch
+ join incoming_ref
+ on M_BranchID = incomingRefM_BranchID
+ where incomingRefID = ?";
+ $qry = $this->db->query($sql, array($incomingRefID));
+ $branchID = 0;
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows)>0) {
+ $branchID = $rows[0]["M_BranchID"];
+ $branchIPAddress = $rows[0]["M_BranchIPAddress"];
+ }
+ }
+ if ($branchID == 0 ) {
+ return false;
+ }
+
+ $note = "$stage by $username";
+ if ($s_detail_ids!= "0" ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefDetailT_OrderDetailID,
+ incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ ? note
+ from incoming_ref_detail
+ join incoming_ref on incomingRefID = incomingRefDetailIncomingRefID
+ and incomingRefDetailID in ($s_detail_ids)
+ left join t_orderdetail on incomingRefDetailNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefDetailT_TestID = T_OrderDetailT_TestID";
+ $qry = $this->db->query($sql, array($note));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+ if ($s_child_ids!= "0" ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefChildT_OrderDetailID incomingRefDetailT_OrderDetailID,
+ '' incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ ? note
+ from incoming_ref_child
+ join incoming_ref on incomingRefID = incomingRefChildIncomingRefID
+ and incomingRefChildID in ($s_child_ids)
+ left join t_orderdetail on incomingRefChildNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefChildT_TestID = T_OrderDetailT_TestID";
+ $qry = $this->db->query($sql, array($note));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+ }
+
+ public function update($stage,$orderDetailID,$username)
+ {
+ $CI =& get_instance();
+ $this->db = $CI->load->database("onedev",true);
+ $sql = "select T_OrderDetailT_TestID, T_OrderDetailT_OrderHeaderID
+ from
+ t_orderdetail
+ where T_OrderDetailID = ? ";
+ $qry = $this->db->query($sql, array($orderDetailID));
+ $incomingRefID = 0;
+ $incomingRefDetailID = 0;
+ $flag_child = false;
+ if ($qry) {
+ $rows = $qry->result_array();
+ $flag_found = false;
+ if(count($rows) > 0 ) {
+ $headerID = $rows[0]["T_OrderDetailT_OrderHeaderID"];
+ $testID = $rows[0]["T_OrderDetailT_TestID"];
+ $sql = "select incomingRefDetailID , incomingRefDetailIncomingRefID
+ from incoming_ref_detail
+ where incomingRefDetailNewT_OrderHeaderID = ?
+ and incomingRefDetailT_TestID = ?";
+ $qryd = $this->db->query($sql, array($headerID,$testID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefDetailIncomingRefID"];
+ $incomingRefDetailID = $rowsd[0]["incomingRefDetailID"];
+ $flag_found = true;
+ }
+ }
+ //check child
+ if(! $flag_found ) {
+ $sql = "select incomingRefChildID , incomingRefChildIncomingRefID
+ from incoming_ref_child
+ where incomingRefChildNewT_OrderHeaderID = ?
+ and incomingRefChildT_TestID = ?";
+ $qryd = $this->db->query($sql, array($headerID,$testID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefChildIncomingRefID"];
+ $incomingRefDetailID = $rowsd[0]["incomingRefChildID"];
+ $flag_found = true;
+ $flag_child = true;
+ }
+ }
+ }
+ }
+ }
+ if ($incomingRefDetailID == 0 || $incomingRefDetailID == "") {
+ return false;
+ }
+ $sql = "select M_BranchID, M_BranchIPAddress
+ from m_branch
+ join incoming_ref
+ on M_BranchID = incomingRefM_BranchID
+ where incomingRefID = ?";
+ $qry = $this->db->query($sql, array($incomingRefID));
+ $branchID = 0;
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows)>0) {
+ $branchID = $rows[0]["M_BranchID"];
+ $branchIPAddress = $rows[0]["M_BranchIPAddress"];
+ }
+ }
+ if ($branchID == 0 ) {
+ return false;
+ }
+
+ $note = "$stage by $username";
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefDetailT_OrderDetailID,
+ incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ ? note
+ from incoming_ref_detail
+ join incoming_ref on incomingRefID = incomingRefDetailIncomingRefID
+ and incomingRefDetailID = ?
+ left join t_orderdetail on incomingRefDetailNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefDetailT_TestID = T_OrderDetailT_TestID";
+ if ($flag_child ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefChildT_OrderDetailID incomingRefDetailT_OrderDetailID,
+ '' incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ ? note
+ from incoming_ref_child
+ join incoming_ref on incomingRefID = incomingRefChildIncomingRefID
+ and incomingRefChildID = ?
+ left join t_orderdetail on incomingRefChildNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefChildT_TestID = T_OrderDetailT_TestID";
+ }
+ $qry = $this->db->query($sql, array($note, $incomingRefDetailID));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+}
diff --git a/application/libraries/Txbranchstatus.php b/application/libraries/Txbranchstatus.php
new file mode 100644
index 00000000..75fb2d56
--- /dev/null
+++ b/application/libraries/Txbranchstatus.php
@@ -0,0 +1,300 @@
+db = $CI->load->database("onedev",true);
+ $s_ids = join(",",$ids);
+ $sql = "select T_OrderDetailT_TestID, T_OrderDetailT_OrderHeaderID
+ from
+ t_orderdetail
+ where T_OrderDetailID in ($s_ids) ";
+ $qry = $this->db->query($sql);
+ $incomingRefID = 0;
+ $s_detail_ids = "0";
+ $s_child_ids = "0";
+ $headerID = 0;
+
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows) > 0 ) {
+ $headerID = $rows[0]["T_OrderDetailT_OrderHeaderID"];
+ $s_test = "0";
+ foreach($rows as $r) {
+ $s_test .= "," . $r["T_OrderDetailT_TestID"];
+ }
+ $sql = "select incomingRefDetailID , incomingRefDetailIncomingRefID
+ from incoming_ref_detail
+ where incomingRefDetailNewT_OrderHeaderID = ?
+ and incomingRefDetailT_TestID in ($s_test) ";
+ $qryd = $this->db->query($sql, array($headerID));
+ $flag_found = false;
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefDetailIncomingRefID"];
+ foreach($rowsd as $r) {
+ $s_detail_ids .= "," . $r["incomingRefDetailID"];
+ }
+ }
+ }
+ //check child
+ if(! $flag_found ) {
+ $sql = "select incomingRefChildID , incomingRefChildIncomingRefID
+ from incoming_ref_child
+ where incomingRefChildNewT_OrderHeaderID = ?
+ and incomingRefChildT_TestID in ($s_test) ";
+ $qryd = $this->db->query($sql, array($headerID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefChildIncomingRefID"];
+ foreach($rowsd as $r) {
+ $s_child_ids .= "," . $r["incomingRefChildID"];
+ }
+ }
+ }
+ }
+ }
+ }
+ if ($s_detail_ids == "0" && $s_child_ids == "0" ) {
+ return false;
+ }
+ $sql = "select M_BranchID, M_BranchIPAddress
+ from m_branch
+ join incoming_ref
+ on M_BranchID = incomingRefM_BranchID
+ where incomingRefID = ?";
+ $qry = $this->db->query($sql, array($incomingRefID));
+ $branchID = 0;
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows)>0) {
+ $branchID = $rows[0]["M_BranchID"];
+ $branchIPAddress = $rows[0]["M_BranchIPAddress"];
+ }
+ }
+ if ($branchID == 0 ) {
+ return false;
+ }
+ $val_note = "";
+ $val_note_int = "";
+ if ($headerID > 0 ) {
+ $sql = "select T_OrderHeaderAddOnValidationNote, T_OrderHeaderAddOnValidationInternal
+ from t_orderheaderaddon
+ where T_orderHeaderAddOnT_OrderHeaderID = ?";
+ $qry = $this->db->query($sql,array($headerID));
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0 ) {
+ $val_note = $rows[0]["T_OrderHeaderAddOnValidationNote"];
+ $val_note_int = $rows[0]["T_OrderHeaderAddOnValidationInternal"];
+ if ( $val_note == null ) $val_note = "";
+ if ( $val_note_int == null ) $val_note_int = "";
+ }
+ }
+ }
+ $note = "$stage by $username";
+ if ($s_detail_ids!= "0" ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefDetailID,
+ incomingRefDetailT_OrderDetailID,
+ incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ T_OrderDetailNote,
+ ? note,
+ ? validation_note,
+ ? validation_note_internal
+ from incoming_ref_detail
+ join incoming_ref on incomingRefID = incomingRefDetailIncomingRefID
+ and incomingRefDetailID in ($s_detail_ids)
+ left join t_orderdetail on incomingRefDetailNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefDetailT_TestID = T_OrderDetailT_TestID";
+ $qry = $this->db->query($sql, array($note,$val_note,$val_note_int));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+ if ($s_child_ids!= "0" ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefChildID,
+ incomingRefChildT_OrderDetailID incomingRefDetailT_OrderDetailID,
+ '' incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ T_OrderDetailNote,
+ ? note,
+ ? validation_note,
+ ? validation_note_internal
+ from incoming_ref_child
+ join incoming_ref on incomingRefID = incomingRefChildIncomingRefID
+ and incomingRefChildID in ($s_child_ids)
+ left join t_orderdetail on incomingRefChildNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefChildT_TestID = T_OrderDetailT_TestID";
+ $qry = $this->db->query($sql, array($note,$val_note,$val_note_int));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+ }
+
+ public function update($stage,$orderDetailID,$username)
+ {
+ $CI =& get_instance();
+ $this->db = $CI->load->database("onedev",true);
+ $sql = "select T_OrderDetailT_TestID, T_OrderDetailT_OrderHeaderID
+ from
+ t_orderdetail
+ where T_OrderDetailID = ? ";
+ $qry = $this->db->query($sql, array($orderDetailID));
+ $incomingRefID = 0;
+ $incomingRefDetailID = 0;
+ $flag_child = false;
+ if ($qry) {
+ $rows = $qry->result_array();
+ $flag_found = false;
+ if(count($rows) > 0 ) {
+ $headerID = $rows[0]["T_OrderDetailT_OrderHeaderID"];
+ $testID = $rows[0]["T_OrderDetailT_TestID"];
+ $sql = "select incomingRefDetailID , incomingRefDetailIncomingRefID
+ from incoming_ref_detail
+ where incomingRefDetailNewT_OrderHeaderID = ?
+ and incomingRefDetailT_TestID = ?";
+ $qryd = $this->db->query($sql, array($headerID,$testID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefDetailIncomingRefID"];
+ $incomingRefDetailID = $rowsd[0]["incomingRefDetailID"];
+ $flag_found = true;
+ }
+ }
+ //check child
+ if(! $flag_found ) {
+ $sql = "select incomingRefChildID , incomingRefChildIncomingRefID
+ from incoming_ref_child
+ where incomingRefChildNewT_OrderHeaderID = ?
+ and incomingRefChildT_TestID = ?";
+ $qryd = $this->db->query($sql, array($headerID,$testID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefChildIncomingRefID"];
+ $incomingRefDetailID = $rowsd[0]["incomingRefChildID"];
+ $flag_found = true;
+ $flag_child = true;
+ }
+ }
+ }
+ }
+ }
+ if ($incomingRefDetailID == 0 || $incomingRefDetailID == "") {
+ return false;
+ }
+ $sql = "select M_BranchID, M_BranchIPAddress
+ from m_branch
+ join incoming_ref
+ on M_BranchID = incomingRefM_BranchID
+ where incomingRefID = ?";
+ $qry = $this->db->query($sql, array($incomingRefID));
+ $branchID = 0;
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows)>0) {
+ $branchID = $rows[0]["M_BranchID"];
+ $branchIPAddress = $rows[0]["M_BranchIPAddress"];
+ }
+ }
+ if ($branchID == 0 ) {
+ return false;
+ }
+
+ $val_note = "";
+ $val_note_int = "";
+ if ($headerID > 0 ) {
+ $sql = "select T_OrderHeaderAddOnValidationNote, T_OrderHeaderAddOnValidationInternal
+ from t_orderheaderaddon
+ where T_orderHeaderAddOnT_OrderHeaderID = ?";
+ $qry = $this->db->query($sql,array($headerID));
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0 ) {
+ $val_note = $rows[0]["T_OrderHeaderAddOnValidationNote"];
+ $val_note_int = $rows[0]["T_OrderHeaderAddOnValidationInternal"];
+ if ( $val_note == null ) $val_note = "";
+ if ( $val_note_int == null ) $val_note_int = "";
+ }
+ }
+ }
+ $note = "$stage by $username";
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefDetailID,
+ incomingRefDetailT_OrderDetailID,
+ incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ T_OrderDetailNote,
+ ? note,
+ ? validation_note,
+ ? validation_note_internal
+ from incoming_ref_detail
+ join incoming_ref on incomingRefID = incomingRefDetailIncomingRefID
+ and incomingRefDetailID = ?
+ left join t_orderdetail on incomingRefDetailNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefDetailT_TestID = T_OrderDetailT_TestID";
+ if ($flag_child ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefChildID,
+ incomingRefChildT_OrderDetailID incomingRefDetailT_OrderDetailID,
+ '' incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ T_OrderDetailNote,
+ ? note,
+ ? validation_note,
+ ? validation_note_internal
+ from incoming_ref_child
+ join incoming_ref on incomingRefID = incomingRefChildIncomingRefID
+ and incomingRefChildID = ?
+ left join t_orderdetail on incomingRefChildNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefChildT_TestID = T_OrderDetailT_TestID";
+ }
+ $qry = $this->db->query($sql, array($note, $val_note, $val_note_int, $incomingRefDetailID));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+}
diff --git a/application/libraries/Txbranchstatus_updated.php b/application/libraries/Txbranchstatus_updated.php
new file mode 100644
index 00000000..79eba71b
--- /dev/null
+++ b/application/libraries/Txbranchstatus_updated.php
@@ -0,0 +1,296 @@
+db = $CI->load->database("onedev",true);
+ $s_ids = join(",",$ids);
+ $sql = "select T_OrderDetailT_TestID, T_OrderDetailT_OrderHeaderID
+ from
+ t_orderdetail
+ where T_OrderDetailID in ($s_ids) ";
+ $qry = $this->db->query($sql);
+ $incomingRefID = 0;
+ $s_detail_ids = "0";
+ $s_child_ids = "0";
+ $headerID = 0;
+
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows) > 0 ) {
+ $headerID = $rows[0]["T_OrderDetailT_OrderHeaderID"];
+ $s_test = "0";
+ foreach($rows as $r) {
+ $s_test .= "," . $r["T_OrderDetailT_TestID"];
+ }
+ $sql = "select incomingRefDetailID , incomingRefDetailIncomingRefID
+ from incoming_ref_detail
+ where incomingRefDetailNewT_OrderHeaderID = ?
+ and incomingRefDetailT_TestID in ($s_test) ";
+ $qryd = $this->db->query($sql, array($headerID));
+ $flag_found = false;
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefDetailIncomingRefID"];
+ foreach($rowsd as $r) {
+ $s_detail_ids .= "," . $r["incomingRefDetailID"];
+ }
+ }
+ }
+ //check child
+ if(! $flag_found ) {
+ $sql = "select incomingRefChildID , incomingRefChildIncomingRefID
+ from incoming_ref_child
+ where incomingRefChildNewT_OrderHeaderID = ?
+ and incomingRefChildT_TestID in ($s_test) ";
+ $qryd = $this->db->query($sql, array($headerID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefChildIncomingRefID"];
+ foreach($rowsd as $r) {
+ $s_child_ids .= "," . $r["incomingRefChildID"];
+ }
+ }
+ }
+ }
+ }
+ }
+ if ($s_detail_ids == "0" && $s_child_ids == "0" ) {
+ return false;
+ }
+ $sql = "select M_BranchID, M_BranchIPAddress
+ from m_branch
+ join incoming_ref
+ on M_BranchID = incomingRefM_BranchID
+ where incomingRefID = ?";
+ $qry = $this->db->query($sql, array($incomingRefID));
+ $branchID = 0;
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows)>0) {
+ $branchID = $rows[0]["M_BranchID"];
+ $branchIPAddress = $rows[0]["M_BranchIPAddress"];
+ }
+ }
+ if ($branchID == 0 ) {
+ return false;
+ }
+ $val_note = "";
+ $val_note_int = "";
+ if ($headerID > 0 ) {
+ $sql = "select T_OrderHeaderAddOnValidationNote, T_OrderHeaderAddOnValidationInternal
+ from t_orderheaderaddon
+ where T_orderHeaderAddOnT_OrderHeaderID = ?";
+ $qry = $this->db->query($sql,array($headerID));
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0 ) {
+ $val_note = $rows[0]["T_OrderHeaderAddOnValidationNote"];
+ $val_note_int = $rows[0]["T_OrderHeaderAddOnValidationInternal"];
+ if ( $val_note == null ) $val_note = "";
+ if ( $val_note_int == null ) $val_note_int = "";
+ }
+ }
+ }
+ $note = "$stage by $username";
+ if ($s_detail_ids!= "0" ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefDetailT_OrderDetailID,
+ incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ T_OrderDetailNote,
+ ? note,
+ ? validation_note,
+ ? validation_note_internal
+ from incoming_ref_detail
+ join incoming_ref on incomingRefID = incomingRefDetailIncomingRefID
+ and incomingRefDetailID in ($s_detail_ids)
+ left join t_orderdetail on incomingRefDetailNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefDetailT_TestID = T_OrderDetailT_TestID";
+ $qry = $this->db->query($sql, array($note,$val_note,$val_note_int));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+ if ($s_child_ids!= "0" ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefChildT_OrderDetailID incomingRefDetailT_OrderDetailID,
+ '' incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ T_OrderDetailNote,
+ ? note,
+ ? validation_note,
+ ? validation_note_internal
+ from incoming_ref_child
+ join incoming_ref on incomingRefID = incomingRefChildIncomingRefID
+ and incomingRefChildID in ($s_child_ids)
+ left join t_orderdetail on incomingRefChildNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefChildT_TestID = T_OrderDetailT_TestID";
+ $qry = $this->db->query($sql, array($note,$val_note,$val_note_int));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+ }
+
+ public function update($stage,$orderDetailID,$username)
+ {
+ $CI =& get_instance();
+ $this->db = $CI->load->database("onedev",true);
+ $sql = "select T_OrderDetailT_TestID, T_OrderDetailT_OrderHeaderID
+ from
+ t_orderdetail
+ where T_OrderDetailID = ? ";
+ $qry = $this->db->query($sql, array($orderDetailID));
+ $incomingRefID = 0;
+ $incomingRefDetailID = 0;
+ $flag_child = false;
+ if ($qry) {
+ $rows = $qry->result_array();
+ $flag_found = false;
+ if(count($rows) > 0 ) {
+ $headerID = $rows[0]["T_OrderDetailT_OrderHeaderID"];
+ $testID = $rows[0]["T_OrderDetailT_TestID"];
+ $sql = "select incomingRefDetailID , incomingRefDetailIncomingRefID
+ from incoming_ref_detail
+ where incomingRefDetailNewT_OrderHeaderID = ?
+ and incomingRefDetailT_TestID = ?";
+ $qryd = $this->db->query($sql, array($headerID,$testID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefDetailIncomingRefID"];
+ $incomingRefDetailID = $rowsd[0]["incomingRefDetailID"];
+ $flag_found = true;
+ }
+ }
+ //check child
+ if(! $flag_found ) {
+ $sql = "select incomingRefChildID , incomingRefChildIncomingRefID
+ from incoming_ref_child
+ where incomingRefChildNewT_OrderHeaderID = ?
+ and incomingRefChildT_TestID = ?";
+ $qryd = $this->db->query($sql, array($headerID,$testID));
+ if($qryd) {
+ $rowsd = $qryd->result_array();
+ if ( count($rowsd) > 0 ) {
+ $incomingRefID = $rowsd[0]["incomingRefChildIncomingRefID"];
+ $incomingRefDetailID = $rowsd[0]["incomingRefChildID"];
+ $flag_found = true;
+ $flag_child = true;
+ }
+ }
+ }
+ }
+ }
+ if ($incomingRefDetailID == 0 || $incomingRefDetailID == "") {
+ return false;
+ }
+ $sql = "select M_BranchID, M_BranchIPAddress
+ from m_branch
+ join incoming_ref
+ on M_BranchID = incomingRefM_BranchID
+ where incomingRefID = ?";
+ $qry = $this->db->query($sql, array($incomingRefID));
+ $branchID = 0;
+ if ($qry) {
+ $rows = $qry->result_array();
+ if(count($rows)>0) {
+ $branchID = $rows[0]["M_BranchID"];
+ $branchIPAddress = $rows[0]["M_BranchIPAddress"];
+ }
+ }
+ if ($branchID == 0 ) {
+ return false;
+ }
+
+ $val_note = "";
+ $val_note_int = "";
+ if ($headerID > 0 ) {
+ $sql = "select T_OrderHeaderAddOnValidationNote, T_OrderHeaderAddOnValidationInternal
+ from t_orderheaderaddon
+ where T_orderHeaderAddOnT_OrderHeaderID = ?";
+ $qry = $this->db->query($sql,array($headerID));
+ if ($qry) {
+ $rows = $qry->result_array();
+ if (count($rows) > 0 ) {
+ $val_note = $rows[0]["T_OrderHeaderAddOnValidationNote"];
+ $val_note_int = $rows[0]["T_OrderHeaderAddOnValidationInternal"];
+ if ( $val_note == null ) $val_note = "";
+ if ( $val_note_int == null ) $val_note_int = "";
+ }
+ }
+ }
+ $note = "$stage by $username";
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefDetailT_OrderDetailID,
+ incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ T_OrderDetailNote,
+ ? note,
+ ? validation_note,
+ ? validation_note_internal
+ from incoming_ref_detail
+ join incoming_ref on incomingRefID = incomingRefDetailIncomingRefID
+ and incomingRefDetailID = ?
+ left join t_orderdetail on incomingRefDetailNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefDetailT_TestID = T_OrderDetailT_TestID";
+ if ($flag_child ) {
+ $sql = "select
+ incomingRefT_RefDeliveryOrderID,
+ incomingRefChildT_OrderDetailID incomingRefDetailT_OrderDetailID,
+ '' incomingRefDetailStatus,
+ T_OrderDetailResult,
+ T_OrderDetailNat_NormalValueID,
+ T_OrderDetailVerification,
+ T_OrderDetailValidation,
+ T_OrderDetailNote,
+ ? note,
+ ? validation_note,
+ ? validation_note_internal
+ from incoming_ref_child
+ join incoming_ref on incomingRefID = incomingRefChildIncomingRefID
+ and incomingRefChildID = ?
+ left join t_orderdetail on incomingRefChildNewT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
+ and T_OrderDetailIsActive = 'Y' and incomingRefChildT_TestID = T_OrderDetailT_TestID";
+ }
+ $qry = $this->db->query($sql, array($note, $val_note, $val_note_int, $incomingRefDetailID));
+ if ($qry) {
+ $rows = $qry->result_array();
+ $param = json_encode($rows);
+ //insert to
+ $sql = "insert into tx_branch_status(TxBranchStatusStage, TxBranchStatusM_BranchID,
+ TxBranchStatusM_BranchIP, TxBranchStatusJson,TxBranchStatusNote )
+ values (?,?,?,?,?)";
+ $qry = $this->db->query($sql, array($stage,$branchID, $branchIPAddress, $param, $note));
+ }
+ }
+}
diff --git a/application/libraries/Wa_krmv3.php b/application/libraries/Wa_krmv3.php
new file mode 100644
index 00000000..7aeffea7
--- /dev/null
+++ b/application/libraries/Wa_krmv3.php
@@ -0,0 +1,63 @@
+client = new ClientV3([
+ "deviceId" => $this->device_id,
+ "refreshToken" => $this->refresh_token,
+ "idToken" => $this->id_token
+ ]);
+ }
+ function upload($url)
+ {
+ //create tmp file
+ $fname = tempnam("/tmp", "rpt") . "-rpt.pdf";
+ file_put_contents($fname, file_get_contents($url));
+ $resp = $this->client->upload($fname);
+ unlink($fname);
+ return $resp;
+ }
+ function send_qrcode($phone, $url, $name, $date)
+ {
+ $urlImg = $this->upload($url);
+ $message = [$name, $date];
+ $resp = $this->client->sendMessageTemplateImage($phone, $this->template, "id", $message, $urlImg);
+ return json_decode($resp, true);
+ }
+ function send_otp($phone, $otp)
+ {
+ $resp = $this->client->sendMessageTemplateAuthentication($phone, "pramitamobileotp", "id", $otp);
+ return json_decode($resp, true);
+ }
+ function send_rujukan_external_process($phone, $phone_cabang)
+ {
+
+ $message = [$phone_cabang];
+ $resp = $this->client->sendMessageTemplateText($phone, "rujukan01", "id", $message);
+ return json_decode($resp, true);
+ }
+ function send_eform($phone, $kode_cabang, $nolab, $type = "")
+ {
+
+ $message = [$kode_cabang, $nolab];
+ $resp = $this->client->sendMessageTemplateText($phone, "eform_fisik", "id", $message);
+ return json_decode($resp, true);
+ }
+ function send_msg_button($phone, $url)
+ {
+ $body = ["hello", "world", "there"];
+ $resp = $this->client->sendMessageTemplateButton($phone, "sample-message-button", "id", $body, $url);
+ return json_decode($resp, true);
+ }
+}
diff --git a/application/libraries/Wa_sas.php b/application/libraries/Wa_sas.php
new file mode 100644
index 00000000..56724214
--- /dev/null
+++ b/application/libraries/Wa_sas.php
@@ -0,0 +1,159 @@
+host = "http://sasdev.jala.my.id:3000/send/";
+ //$this->host = "http://139.59.235.205:3000/send/";
+ $this->host = "http://devkedungdoro.aplikasi.web.id:7001/send/";
+ $this->username = "sasdev";
+ $this->password = "sasdev!#102938";
+ }
+ function fix_phone($phone)
+ {
+ //remove - and space
+ $phone = str_replace("-", "", $phone);
+ $phone = str_replace(" ", "", $phone);
+ //remove 1st +
+ if (substr($phone, 0, 1) == "+") {
+ $phone = substr($phone, 1);
+ }
+ if (substr($phone, 0, 1) == "0") {
+ $phone = "62" . substr($phone, 1);
+ }
+ if (substr($phone, 0, 2) != "62") {
+ $phone = "62" . $phone;
+ }
+ return $phone;
+ }
+
+ function send_image_group(
+ $phone,
+ $caption,
+ $url_image,
+ $contentType,
+ $file_name,
+ $extension,
+ $view_once = false,
+ $compress = false
+ ) {
+ $tmpFile = tempnam(sys_get_temp_dir(), 'sasdev') . ".$extension";
+ file_put_contents($tmpFile, file_get_contents($url_image));
+ $data = [
+ "phone" => $phone,
+ "caption" => $caption,
+ "view_once" => $view_once,
+ "compress" => $compress,
+ "image" => curl_file_create($tmpFile, $contentType, $file_name)
+ ];
+ $ch = curl_init($this->host . "image");
+ //curl_setopt($ch, CURLOPT_HEADER, 1);
+ curl_setopt($ch, CURLOPT_USERPWD, $this->username . ":" . $this->password);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
+ $return = curl_exec($ch);
+ curl_close($ch);
+ unlink($tmpFile);
+ $j_return = json_decode($return, true);
+ if (json_last_error() != 0) {
+ return ["code" => "ERROR", "message" => "Error Json Decode : $return"];
+ }
+ return $j_return;
+ }
+ function send_message($phone, $message, $is_group = false)
+ {
+ $data = [
+ "phone" => $is_group ? $phone : $this->fix_phone($phone),
+ "message" => $message
+ ];
+ $ch = curl_init($this->host . "message");
+ curl_setopt($ch, CURLOPT_USERPWD, $this->username . ":" . $this->password);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+ $return = curl_exec($ch);
+ curl_close($ch);
+ $j_return = json_decode($return, true);
+
+ if (json_last_error() != 0) {
+ return ["code" => "ERROR", "message" => "Error Json Decode : $return"];
+ }
+ return $j_return;
+ }
+ function send_image(
+ $phone,
+ $caption,
+ $url_image,
+ $contentType,
+ $file_name,
+ $extension,
+ $view_once = false,
+ $compress = false
+ ) {
+ $tmpFile = tempnam(sys_get_temp_dir(), 'sasdev') . ".$extension";
+ file_put_contents($tmpFile, file_get_contents($url_image));
+ $data = [
+ "phone" => $this->fix_phone($phone),
+ "caption" => $caption,
+ "view_once" => $view_once,
+ "compress" => $compress,
+ "image" => curl_file_create($tmpFile, $contentType, $file_name)
+ ];
+ $ch = curl_init($this->host . "image");
+ //curl_setopt($ch, CURLOPT_HEADER, 1);
+ curl_setopt($ch, CURLOPT_USERPWD, $this->username . ":" . $this->password);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
+ $return = curl_exec($ch);
+ curl_close($ch);
+ unlink($tmpFile);
+ $j_return = json_decode($return, true);
+ if (json_last_error() != 0) {
+ return ["code" => "ERROR", "message" => "Error Json Decode : $return"];
+ }
+ return $j_return;
+ }
+ function send_file(
+ $phone,
+ $caption,
+ $url_file,
+ $contentType,
+ $file_name,
+ $extension,
+ $compress = false
+ ) {
+ $tmpFile = tempnam(sys_get_temp_dir(), 'sasdev') . ".$extension";
+ file_put_contents($tmpFile, file_get_contents($url_file));
+ $data = [
+ "phone" => $this->fix_phone($phone),
+ "caption" => $caption,
+ "compress" => $compress,
+ "file" => curl_file_create($tmpFile, $contentType, $file_name)
+ ];
+ $ch = curl_init($this->host . "file");
+ //curl_setopt($ch, CURLOPT_HEADER, 1);
+ curl_setopt($ch, CURLOPT_USERPWD, $this->username . ":" . $this->password);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
+ $return = curl_exec($ch);
+ curl_close($ch);
+ unlink($tmpFile);
+ $j_return = json_decode($return, true);
+ if (json_last_error() != 0) {
+ return ["code" => "ERROR", "message" => "Error Json Decode : $return"];
+ }
+ return $j_return;
+ }
+}
diff --git a/application/libraries/his/Simrs.php b/application/libraries/his/Simrs.php
new file mode 100644
index 00000000..aa54e190
--- /dev/null
+++ b/application/libraries/his/Simrs.php
@@ -0,0 +1,127 @@
+HisEndPoint = "http://34.101.132.130:8080/query";
+ $this->Timeout = 10;
+ $this->token = "";
+ $this->userName = "adiet";
+ $this->password = "qwerty";
+ }
+
+ function get_token() {
+ if (! file_exists("/tmp/his-token.json")) {
+ $this->login($this->userName,$this->password);
+ } else {
+ $jtoken = file_get_contents("/tmp/his-token.json");
+ $token = json_decode($jtoken,true);
+ $expired = $token["expired"];
+ if ($expired - time() > 180 ) {
+ return "{$token["token"]}";
+ } else {
+ $new_token = $this->login("x");
+ return $new_token;
+ }
+ }
+ }
+
+ function login($debug = "") {
+ list($is_ok,$enc_password)= $this->gql(
+ "mutation",
+ "passwordEncrypt",
+ ["password" => "String!"],
+ ["password" => $this->password],
+ "",
+ "",
+ $debug
+ );
+ if(! $is_ok) {
+ if ($debug != "") echo "Error : {$this->password} => $enc_password\n";
+ return false;
+ }
+ list($is_ok,$tokenResponse)= $this->gql(
+ "mutation",
+ "userLogin",
+ ["userName" => "String!", "password" => "String!"],
+ ["userName" => $this->userName, "password" => $enc_password],
+ "userID token expired",
+ "",
+ $debug
+ );
+ if(!$is_ok) return false;
+
+ file_put_contents("/tmp/his-token.json",json_encode($tokenResponse));
+ return $tokenResponse["token"];
+ }
+
+ function gql($type, $name, $param, $variable, $return = "",
+ $token = "",
+ $debug = "")
+ {
+ $prm_gql= "";
+ $prm_body = "";
+ foreach($param as $k => $v) {
+ if ($prm_gql!= "") $prm_gql .= ",";
+ $prm_gql.= '$' . $k . ":" . $v;
+ if ($prm_body != "") $prm_body .= ",";
+ $prm_body .= $k . ":$" . $k;
+ }
+ $body = [];
+ if ($return == "") {
+ $body["query"] = "{$type}($prm_gql){{$name}($prm_body)}";
+ } else {
+ $body["query"] = "{$type}($prm_gql){ {$name}($prm_body){ $return } }";
+ }
+ $body["variables"] = $variable;
+ $gql_body = json_encode($body);
+ if($debug != "") {
+ echo "Debug GQL: $gql_body \n";
+ }
+ $resp =$this->post($gql_body,$token);
+ if($debug != "") {
+ echo "Response GQL: $resp \n";
+ }
+ $j_resp = json_decode($resp,true);
+ if ($j_resp !== false) {
+ if ($j_resp["data"] != null) {
+ $result = $j_resp["data"][$name];
+ if ($debug != "") {
+ print_r($result);
+ }
+ return [true,$result];
+ } else {
+ return [false,json_encode($j_resp["error"])];
+ }
+ }
+ return [false,$resp];
+ }
+
+ function post($data,$token = "")
+ {
+ $ch = curl_init($this->HisEndPoint);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->Timeout / 2);
+ curl_setopt($ch, CURLOPT_TIMEOUT, $this->Timeout);
+ if ($token == "") {
+ curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ "Content-Type: application/json",
+ "Content-Length: " . strlen($data),
+ ]);
+ } else {
+ curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ "Authorization: Bearer $token",
+ "Content-Type: application/json",
+ "Content-Length: " . strlen($data),
+ ]);
+ }
+ $result = curl_exec($ch);
+ if (curl_error($ch) != "") {
+ return "ERROR SIMRS HIS API {$this->HisEndPoint} : " . curl_error($ch) . "\n";
+ }
+ curl_close($ch);
+ return $result;
+ }}
+
diff --git a/application/libraries/index.html b/application/libraries/index.html
new file mode 100755
index 00000000..b702fbc3
--- /dev/null
+++ b/application/libraries/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/application/libraries/qrcode/phpqrcode.php b/application/libraries/qrcode/phpqrcode.php
new file mode 100644
index 00000000..ea8c08f9
--- /dev/null
+++ b/application/libraries/qrcode/phpqrcode.php
@@ -0,0 +1,3312 @@
+
+ *
+ * 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 3 of the License, or 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+/*
+ * Version: 1.1.4
+ * Build: 2010100721
+ */
+
+
+
+//---- qrconst.php -----------------------------
+
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Common constants
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * 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 3 of the License, or 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ // Encoding modes
+
+ define('QR_MODE_NUL', -1);
+ define('QR_MODE_NUM', 0);
+ define('QR_MODE_AN', 1);
+ define('QR_MODE_8', 2);
+ define('QR_MODE_KANJI', 3);
+ define('QR_MODE_STRUCTURE', 4);
+
+ // Levels of error correction.
+
+ define('QR_ECLEVEL_L', 0);
+ define('QR_ECLEVEL_M', 1);
+ define('QR_ECLEVEL_Q', 2);
+ define('QR_ECLEVEL_H', 3);
+
+ // Supported output formats
+
+ define('QR_FORMAT_TEXT', 0);
+ define('QR_FORMAT_PNG', 1);
+
+ class qrstr {
+ public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
+ $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
+ }
+ }
+
+
+
+//---- merged_config.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Config file, tuned-up for merged verion
+ */
+
+ define('QR_CACHEABLE', false); // use cache - more disk reads but less CPU power, masks and format templates are stored there
+ define('QR_CACHE_DIR', false); // used when QR_CACHEABLE === true
+ define('QR_LOG_DIR', false); // default error logs dir
+
+ define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
+ define('QR_FIND_FROM_RANDOM', 2); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
+ define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false
+
+ define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
+
+
+
+
+//---- qrtools.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Toolset, handy and debug utilites.
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * 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 3 of the License, or 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRtools {
+
+ //----------------------------------------------------------------------
+ public static function binarize($frame)
+ {
+ $len = count($frame);
+ foreach ($frame as &$frameLine) {
+
+ for($i=0; $i<$len; $i++) {
+ $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0';
+ }
+ }
+
+ return $frame;
+ }
+
+ //----------------------------------------------------------------------
+ public static function tcpdfBarcodeArray($code, $mode = 'QR,L', $tcPdfVersion = '4.5.037')
+ {
+ $barcode_array = array();
+
+ if (!is_array($mode))
+ $mode = explode(',', $mode);
+
+ $eccLevel = 'L';
+
+ if (count($mode) > 1) {
+ $eccLevel = $mode[1];
+ }
+
+ $qrTab = QRcode::text($code, false, $eccLevel);
+ $size = count($qrTab);
+
+ $barcode_array['num_rows'] = $size;
+ $barcode_array['num_cols'] = $size;
+ $barcode_array['bcode'] = array();
+
+ foreach ($qrTab as $line) {
+ $arrAdd = array();
+ foreach(str_split($line) as $char)
+ $arrAdd[] = ($char=='1')?1:0;
+ $barcode_array['bcode'][] = $arrAdd;
+ }
+
+ return $barcode_array;
+ }
+
+ //----------------------------------------------------------------------
+ public static function clearCache()
+ {
+ self::$frames = array();
+ }
+
+ //----------------------------------------------------------------------
+ public static function buildCache()
+ {
+ QRtools::markTime('before_build_cache');
+
+ $mask = new QRmask();
+ for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) {
+ $frame = QRspec::newFrame($a);
+ if (QR_IMAGE) {
+ $fileName = QR_CACHE_DIR.'frame_'.$a.'.png';
+ QRimage::png(self::binarize($frame), $fileName, 1, 0);
+ }
+
+ $width = count($frame);
+ $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
+ for ($maskNo=0; $maskNo<8; $maskNo++)
+ $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
+ }
+
+ QRtools::markTime('after_build_cache');
+ }
+
+ //----------------------------------------------------------------------
+ public static function log($outfile, $err)
+ {
+ if (QR_LOG_DIR !== false) {
+ if ($err != '') {
+ if ($outfile !== false) {
+ file_put_contents(QR_LOG_DIR.basename($outfile).'-errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
+ } else {
+ file_put_contents(QR_LOG_DIR.'errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
+ }
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function dumpMask($frame)
+ {
+ $width = count($frame);
+ for($y=0;$y<$width;$y++) {
+ for($x=0;$x<$width;$x++) {
+ echo ord($frame[$y][$x]).',';
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function markTime($markerId)
+ {
+ list($usec, $sec) = explode(" ", microtime());
+ $time = ((float)$usec + (float)$sec);
+
+ if (!isset($GLOBALS['qr_time_bench']))
+ $GLOBALS['qr_time_bench'] = array();
+
+ $GLOBALS['qr_time_bench'][$markerId] = $time;
+ }
+
+ //----------------------------------------------------------------------
+ public static function timeBenchmark()
+ {
+ self::markTime('finish');
+
+ $lastTime = 0;
+ $startTime = 0;
+ $p = 0;
+
+ echo '
+ BENCHMARK
+ ';
+
+ foreach($GLOBALS['qr_time_bench'] as $markerId=>$thisTime) {
+ if ($p > 0) {
+ echo 'till '.$markerId.': '.number_format($thisTime-$lastTime, 6).'s ';
+ } else {
+ $startTime = $thisTime;
+ }
+
+ $p++;
+ $lastTime = $thisTime;
+ }
+
+ echo '
+ TOTAL: '.number_format($lastTime-$startTime, 6).'s
+
+
';
+ }
+
+ }
+
+ //##########################################################################
+
+ QRtools::markTime('start');
+
+
+
+
+//---- qrspec.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * QR Code specifications
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * The following data / specifications are taken from
+ * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
+ * or
+ * "Automatic identification and data capture techniques --
+ * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
+ *
+ * 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 3 of the License, or 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('QRSPEC_VERSION_MAX', 40);
+ define('QRSPEC_WIDTH_MAX', 177);
+
+ define('QRCAP_WIDTH', 0);
+ define('QRCAP_WORDS', 1);
+ define('QRCAP_REMINDER', 2);
+ define('QRCAP_EC', 3);
+
+ class QRspec {
+
+ public static $capacity = array(
+ array( 0, 0, 0, array( 0, 0, 0, 0)),
+ array( 21, 26, 0, array( 7, 10, 13, 17)), // 1
+ array( 25, 44, 7, array( 10, 16, 22, 28)),
+ array( 29, 70, 7, array( 15, 26, 36, 44)),
+ array( 33, 100, 7, array( 20, 36, 52, 64)),
+ array( 37, 134, 7, array( 26, 48, 72, 88)), // 5
+ array( 41, 172, 7, array( 36, 64, 96, 112)),
+ array( 45, 196, 0, array( 40, 72, 108, 130)),
+ array( 49, 242, 0, array( 48, 88, 132, 156)),
+ array( 53, 292, 0, array( 60, 110, 160, 192)),
+ array( 57, 346, 0, array( 72, 130, 192, 224)), //10
+ array( 61, 404, 0, array( 80, 150, 224, 264)),
+ array( 65, 466, 0, array( 96, 176, 260, 308)),
+ array( 69, 532, 0, array( 104, 198, 288, 352)),
+ array( 73, 581, 3, array( 120, 216, 320, 384)),
+ array( 77, 655, 3, array( 132, 240, 360, 432)), //15
+ array( 81, 733, 3, array( 144, 280, 408, 480)),
+ array( 85, 815, 3, array( 168, 308, 448, 532)),
+ array( 89, 901, 3, array( 180, 338, 504, 588)),
+ array( 93, 991, 3, array( 196, 364, 546, 650)),
+ array( 97, 1085, 3, array( 224, 416, 600, 700)), //20
+ array(101, 1156, 4, array( 224, 442, 644, 750)),
+ array(105, 1258, 4, array( 252, 476, 690, 816)),
+ array(109, 1364, 4, array( 270, 504, 750, 900)),
+ array(113, 1474, 4, array( 300, 560, 810, 960)),
+ array(117, 1588, 4, array( 312, 588, 870, 1050)), //25
+ array(121, 1706, 4, array( 336, 644, 952, 1110)),
+ array(125, 1828, 4, array( 360, 700, 1020, 1200)),
+ array(129, 1921, 3, array( 390, 728, 1050, 1260)),
+ array(133, 2051, 3, array( 420, 784, 1140, 1350)),
+ array(137, 2185, 3, array( 450, 812, 1200, 1440)), //30
+ array(141, 2323, 3, array( 480, 868, 1290, 1530)),
+ array(145, 2465, 3, array( 510, 924, 1350, 1620)),
+ array(149, 2611, 3, array( 540, 980, 1440, 1710)),
+ array(153, 2761, 3, array( 570, 1036, 1530, 1800)),
+ array(157, 2876, 0, array( 570, 1064, 1590, 1890)), //35
+ array(161, 3034, 0, array( 600, 1120, 1680, 1980)),
+ array(165, 3196, 0, array( 630, 1204, 1770, 2100)),
+ array(169, 3362, 0, array( 660, 1260, 1860, 2220)),
+ array(173, 3532, 0, array( 720, 1316, 1950, 2310)),
+ array(177, 3706, 0, array( 750, 1372, 2040, 2430)) //40
+ );
+
+ //----------------------------------------------------------------------
+ public static function getDataLength($version, $level)
+ {
+ return self::$capacity[$version][QRCAP_WORDS] - self::$capacity[$version][QRCAP_EC][$level];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getECCLength($version, $level)
+ {
+ return self::$capacity[$version][QRCAP_EC][$level];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getWidth($version)
+ {
+ return self::$capacity[$version][QRCAP_WIDTH];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getRemainder($version)
+ {
+ return self::$capacity[$version][QRCAP_REMINDER];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getMinimumVersion($size, $level)
+ {
+
+ for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
+ $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
+ if($words >= $size)
+ return $i;
+ }
+
+ return -1;
+ }
+
+ //######################################################################
+
+ public static $lengthTableBits = array(
+ array(10, 12, 14),
+ array( 9, 11, 13),
+ array( 8, 16, 16),
+ array( 8, 10, 12)
+ );
+
+ //----------------------------------------------------------------------
+ public static function lengthIndicator($mode, $version)
+ {
+ if ($mode == QR_MODE_STRUCTURE)
+ return 0;
+
+ if ($version <= 9) {
+ $l = 0;
+ } else if ($version <= 26) {
+ $l = 1;
+ } else {
+ $l = 2;
+ }
+
+ return self::$lengthTableBits[$mode][$l];
+ }
+
+ //----------------------------------------------------------------------
+ public static function maximumWords($mode, $version)
+ {
+ if($mode == QR_MODE_STRUCTURE)
+ return 3;
+
+ if($version <= 9) {
+ $l = 0;
+ } else if($version <= 26) {
+ $l = 1;
+ } else {
+ $l = 2;
+ }
+
+ $bits = self::$lengthTableBits[$mode][$l];
+ $words = (1 << $bits) - 1;
+
+ if($mode == QR_MODE_KANJI) {
+ $words *= 2; // the number of bytes is required
+ }
+
+ return $words;
+ }
+
+ // Error correction code -----------------------------------------------
+ // Table of the error correction code (Reed-Solomon block)
+ // See Table 12-16 (pp.30-36), JIS X0510:2004.
+
+ public static $eccTable = array(
+ array(array( 0, 0), array( 0, 0), array( 0, 0), array( 0, 0)),
+ array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // 1
+ array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)),
+ array(array( 1, 0), array( 1, 0), array( 2, 0), array( 2, 0)),
+ array(array( 1, 0), array( 2, 0), array( 2, 0), array( 4, 0)),
+ array(array( 1, 0), array( 2, 0), array( 2, 2), array( 2, 2)), // 5
+ array(array( 2, 0), array( 4, 0), array( 4, 0), array( 4, 0)),
+ array(array( 2, 0), array( 4, 0), array( 2, 4), array( 4, 1)),
+ array(array( 2, 0), array( 2, 2), array( 4, 2), array( 4, 2)),
+ array(array( 2, 0), array( 3, 2), array( 4, 4), array( 4, 4)),
+ array(array( 2, 2), array( 4, 1), array( 6, 2), array( 6, 2)), //10
+ array(array( 4, 0), array( 1, 4), array( 4, 4), array( 3, 8)),
+ array(array( 2, 2), array( 6, 2), array( 4, 6), array( 7, 4)),
+ array(array( 4, 0), array( 8, 1), array( 8, 4), array(12, 4)),
+ array(array( 3, 1), array( 4, 5), array(11, 5), array(11, 5)),
+ array(array( 5, 1), array( 5, 5), array( 5, 7), array(11, 7)), //15
+ array(array( 5, 1), array( 7, 3), array(15, 2), array( 3, 13)),
+ array(array( 1, 5), array(10, 1), array( 1, 15), array( 2, 17)),
+ array(array( 5, 1), array( 9, 4), array(17, 1), array( 2, 19)),
+ array(array( 3, 4), array( 3, 11), array(17, 4), array( 9, 16)),
+ array(array( 3, 5), array( 3, 13), array(15, 5), array(15, 10)), //20
+ array(array( 4, 4), array(17, 0), array(17, 6), array(19, 6)),
+ array(array( 2, 7), array(17, 0), array( 7, 16), array(34, 0)),
+ array(array( 4, 5), array( 4, 14), array(11, 14), array(16, 14)),
+ array(array( 6, 4), array( 6, 14), array(11, 16), array(30, 2)),
+ array(array( 8, 4), array( 8, 13), array( 7, 22), array(22, 13)), //25
+ array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)),
+ array(array( 8, 4), array(22, 3), array( 8, 26), array(12, 28)),
+ array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)),
+ array(array( 7, 7), array(21, 7), array( 1, 37), array(19, 26)),
+ array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), //30
+ array(array(13, 3), array( 2, 29), array(42, 1), array(23, 28)),
+ array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)),
+ array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)),
+ array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)),
+ array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), //35
+ array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)),
+ array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)),
+ array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)),
+ array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)),
+ array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)),//40
+ );
+
+ //----------------------------------------------------------------------
+ // CACHEABLE!!!
+
+ public static function getEccSpec($version, $level, array &$spec)
+ {
+ if (count($spec) < 5) {
+ $spec = array(0,0,0,0,0);
+ }
+
+ $b1 = self::$eccTable[$version][$level][0];
+ $b2 = self::$eccTable[$version][$level][1];
+ $data = self::getDataLength($version, $level);
+ $ecc = self::getECCLength($version, $level);
+
+ if($b2 == 0) {
+ $spec[0] = $b1;
+ $spec[1] = (int)($data / $b1);
+ $spec[2] = (int)($ecc / $b1);
+ $spec[3] = 0;
+ $spec[4] = 0;
+ } else {
+ $spec[0] = $b1;
+ $spec[1] = (int)($data / ($b1 + $b2));
+ $spec[2] = (int)($ecc / ($b1 + $b2));
+ $spec[3] = $b2;
+ $spec[4] = $spec[1] + 1;
+ }
+ }
+
+ // Alignment pattern ---------------------------------------------------
+
+ // Positions of alignment patterns.
+ // This array includes only the second and the third position of the
+ // alignment patterns. Rest of them can be calculated from the distance
+ // between them.
+
+ // See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
+
+ public static $alignmentPattern = array(
+ array( 0, 0),
+ array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5
+ array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
+ array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), //11-15
+ array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), //16-20
+ array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), //21-25
+ array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52), //26-30
+ array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54), //31-35
+ array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58), //35-40
+ );
+
+
+ /** --------------------------------------------------------------------
+ * Put an alignment marker.
+ * @param frame
+ * @param width
+ * @param ox,oy center coordinate of the pattern
+ */
+ public static function putAlignmentMarker(array &$frame, $ox, $oy)
+ {
+ $finder = array(
+ "\xa1\xa1\xa1\xa1\xa1",
+ "\xa1\xa0\xa0\xa0\xa1",
+ "\xa1\xa0\xa1\xa0\xa1",
+ "\xa1\xa0\xa0\xa0\xa1",
+ "\xa1\xa1\xa1\xa1\xa1"
+ );
+
+ $yStart = $oy-2;
+ $xStart = $ox-2;
+
+ for($y=0; $y<5; $y++) {
+ QRstr::set($frame, $xStart, $yStart+$y, $finder[$y]);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function putAlignmentPattern($version, &$frame, $width)
+ {
+ if($version < 2)
+ return;
+
+ $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
+ if($d < 0) {
+ $w = 2;
+ } else {
+ $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
+ }
+
+ if($w * $w - 3 == 1) {
+ $x = self::$alignmentPattern[$version][0];
+ $y = self::$alignmentPattern[$version][0];
+ self::putAlignmentMarker($frame, $x, $y);
+ return;
+ }
+
+ $cx = self::$alignmentPattern[$version][0];
+ for($x=1; $x<$w - 1; $x++) {
+ self::putAlignmentMarker($frame, 6, $cx);
+ self::putAlignmentMarker($frame, $cx, 6);
+ $cx += $d;
+ }
+
+ $cy = self::$alignmentPattern[$version][0];
+ for($y=0; $y<$w-1; $y++) {
+ $cx = self::$alignmentPattern[$version][0];
+ for($x=0; $x<$w-1; $x++) {
+ self::putAlignmentMarker($frame, $cx, $cy);
+ $cx += $d;
+ }
+ $cy += $d;
+ }
+ }
+
+ // Version information pattern -----------------------------------------
+
+ // Version information pattern (BCH coded).
+ // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
+
+ // size: [QRSPEC_VERSION_MAX - 6]
+
+ public static $versionPattern = array(
+ 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
+ 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9,
+ 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75,
+ 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64,
+ 0x27541, 0x28c69
+ );
+
+ //----------------------------------------------------------------------
+ public static function getVersionPattern($version)
+ {
+ if($version < 7 || $version > QRSPEC_VERSION_MAX)
+ return 0;
+
+ return self::$versionPattern[$version -7];
+ }
+
+ // Format information --------------------------------------------------
+ // See calcFormatInfo in tests/test_qrspec.c (orginal qrencode c lib)
+
+ public static $formatInfo = array(
+ array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976),
+ array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0),
+ array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed),
+ array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b)
+ );
+
+ public static function getFormatInfo($mask, $level)
+ {
+ if($mask < 0 || $mask > 7)
+ return 0;
+
+ if($level < 0 || $level > 3)
+ return 0;
+
+ return self::$formatInfo[$level][$mask];
+ }
+
+ // Frame ---------------------------------------------------------------
+ // Cache of initial frames.
+
+ public static $frames = array();
+
+ /** --------------------------------------------------------------------
+ * Put a finder pattern.
+ * @param frame
+ * @param width
+ * @param ox,oy upper-left coordinate of the pattern
+ */
+ public static function putFinderPattern(&$frame, $ox, $oy)
+ {
+ $finder = array(
+ "\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
+ "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+ "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
+ );
+
+ for($y=0; $y<7; $y++) {
+ QRstr::set($frame, $ox, $oy+$y, $finder[$y]);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function createFrame($version)
+ {
+ $width = self::$capacity[$version][QRCAP_WIDTH];
+ $frameLine = str_repeat ("\0", $width);
+ $frame = array_fill(0, $width, $frameLine);
+
+ // Finder pattern
+ self::putFinderPattern($frame, 0, 0);
+ self::putFinderPattern($frame, $width - 7, 0);
+ self::putFinderPattern($frame, 0, $width - 7);
+
+ // Separator
+ $yOffset = $width - 7;
+
+ for($y=0; $y<7; $y++) {
+ $frame[$y][7] = "\xc0";
+ $frame[$y][$width - 8] = "\xc0";
+ $frame[$yOffset][7] = "\xc0";
+ $yOffset++;
+ }
+
+ $setPattern = str_repeat("\xc0", 8);
+
+ QRstr::set($frame, 0, 7, $setPattern);
+ QRstr::set($frame, $width-8, 7, $setPattern);
+ QRstr::set($frame, 0, $width - 8, $setPattern);
+
+ // Format info
+ $setPattern = str_repeat("\x84", 9);
+ QRstr::set($frame, 0, 8, $setPattern);
+ QRstr::set($frame, $width - 8, 8, $setPattern, 8);
+
+ $yOffset = $width - 8;
+
+ for($y=0; $y<8; $y++,$yOffset++) {
+ $frame[$y][8] = "\x84";
+ $frame[$yOffset][8] = "\x84";
+ }
+
+ // Timing pattern
+
+ for($i=1; $i<$width-15; $i++) {
+ $frame[6][7+$i] = chr(0x90 | ($i & 1));
+ $frame[7+$i][6] = chr(0x90 | ($i & 1));
+ }
+
+ // Alignment pattern
+ self::putAlignmentPattern($version, $frame, $width);
+
+ // Version information
+ if($version >= 7) {
+ $vinf = self::getVersionPattern($version);
+
+ $v = $vinf;
+
+ for($x=0; $x<6; $x++) {
+ for($y=0; $y<3; $y++) {
+ $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
+ $v = $v >> 1;
+ }
+ }
+
+ $v = $vinf;
+ for($y=0; $y<6; $y++) {
+ for($x=0; $x<3; $x++) {
+ $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
+ $v = $v >> 1;
+ }
+ }
+ }
+
+ // and a little bit...
+ $frame[$width - 8][8] = "\x81";
+
+ return $frame;
+ }
+
+ //----------------------------------------------------------------------
+ public static function debug($frame, $binary_mode = false)
+ {
+ if ($binary_mode) {
+
+ foreach ($frame as &$frameLine) {
+ $frameLine = join(' ', explode('0', $frameLine));
+ $frameLine = join('██', explode('1', $frameLine));
+ }
+
+ ?>
+
+
';
+ echo join("
", $frame);
+ echo ' | BENCHMARK | |
| till '.$markerId.': | '.number_format($thisTime-$lastTime, 6).'s |
|---|---|
| TOTAL: | '.number_format($lastTime-$startTime, 6).'s |
Directory access is forbidden.
+ + + diff --git a/application/models/index.html b/application/models/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/models/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/views/errors/cli/error_404.php b/application/views/errors/cli/error_404.php new file mode 100755 index 00000000..6984b61e --- /dev/null +++ b/application/views/errors/cli/error_404.php @@ -0,0 +1,8 @@ + + +An uncaught Exception was encountered + +Type: +Message: +Filename: getFile(), "\n"; ?> +Line Number: getLine(); ?> + + + +Backtrace: +getTrace() as $error): ?> + + File: + Line: + Function: + + + + diff --git a/application/views/errors/cli/error_general.php b/application/views/errors/cli/error_general.php new file mode 100755 index 00000000..6984b61e --- /dev/null +++ b/application/views/errors/cli/error_general.php @@ -0,0 +1,8 @@ + + +A PHP Error was encountered + +Severity: +Message: +Filename: +Line Number: + + + +Backtrace: + + + File: + Line: + Function: + + + + diff --git a/application/views/errors/cli/index.html b/application/views/errors/cli/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/views/errors/cli/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/views/errors/html/error_404.php b/application/views/errors/html/error_404.php new file mode 100755 index 00000000..756ea9d6 --- /dev/null +++ b/application/views/errors/html/error_404.php @@ -0,0 +1,64 @@ + + + + +Type:
+Message:
+Filename: getFile(); ?>
+Line Number: getLine(); ?>
+ + + +Backtrace:
+ getTrace() as $error): ?> + + + +
+ File:
+ Line:
+ Function:
+
Severity:
+Message:
+Filename:
+Line Number:
+ + + +Backtrace:
+ + + + +
+ File:
+ Line:
+ Function:
+
Directory access is forbidden.
+ + + diff --git a/application/views/errors/index.html b/application/views/errors/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/views/errors/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/views/index.html b/application/views/index.html new file mode 100755 index 00000000..b702fbc3 --- /dev/null +++ b/application/views/index.html @@ -0,0 +1,11 @@ + + + +Directory access is forbidden.
+ + + diff --git a/application/views/welcome_message.php b/application/views/welcome_message.php new file mode 100755 index 00000000..f5115630 --- /dev/null +++ b/application/views/welcome_message.php @@ -0,0 +1,89 @@ + + + + +The page you are looking at is being generated dynamically by CodeIgniter.
+ +If you would like to edit this page you'll find it located at:
+application/views/welcome_message.php
+
+ The corresponding controller for this page is found at:
+application/controllers/Welcome.php
+
+ If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.
+