Compare commits

..

72 Commits
3.0.0 ... 3.0.1

Author SHA1 Message Date
jekkos
9e8cc93082 Fix upload path in docker cloud setup 2016-11-27 17:17:18 +01:00
FrancescoUK
57de863f79 Update WHATS_NEW 2016-11-26 16:03:16 +00:00
FrancescoUK
00565ddc8f Fix (again) Summary_taxes percent column sorting (#1003) 2016-11-26 15:50:35 +00:00
jekkos
7d4dff0a37 Remove percentage sign from number_sorter regex (#1003) 2016-11-26 15:54:04 +01:00
jekkos
1ed76fa091 Properly parse negative numbers + rename currency_sorter (#1003) 2016-11-26 15:46:27 +01:00
FrancescoUK
114c215407 Fix Summary_discounts percent column sorting (#1003) 2016-11-26 14:39:12 +00:00
FrancescoUK
9bef65b9cb Fix Summary_taxes percent column (#1003) 2016-11-26 14:34:11 +00:00
FrancescoUK
dc4d582898 Fix LICENSE files 2016-11-26 14:12:35 +00:00
jekkos
8b32a26e80 Fix cost label in item summary report (#1003) 2016-11-26 14:52:31 +01:00
jekkos
422e2ddbab Add currency sorting for summary reports (#1003) 2016-11-26 14:49:41 +01:00
FrancescoUK
c5988adbbb Fix read_only flag issue (#1003) 2016-11-26 12:03:22 +00:00
jekkos
2727e91c96 Fix currency sorting in tabular_details (#1003) 2016-11-26 12:17:13 +01:00
jekkos
4304f5ceea Revert tabular_details changes (#1003) 2016-11-26 00:12:33 +01:00
jekkos
1666a3e689 Fix detailed sale + receiving report row update + currency sorting (#1003) 2016-11-25 22:24:46 +01:00
FrancescoUK
2f8d66664b Merge pull request #1006 from rnld26/patch-1
Update LICENSE
2016-11-24 08:57:04 +00:00
Rinaldy@dbarber
7c5276b014 Update LICENSE 2016-11-24 12:13:18 +07:00
FrancescoUK
5231c027af Revert "Support MySQL5.7 in backward compatible mode (#630)"
This reverts commit 7ef68fbc76.
2016-11-21 22:02:44 +00:00
FrancescoUK
3974279607 Fix timezone drop down option typo 2016-11-21 08:27:48 +00:00
FrancescoUK
7ef68fbc76 Support MySQL5.7 in backward compatible mode (#630) 2016-11-20 21:20:52 +00:00
FrancescoUK
1440e6bce9 Upgrade WHATS_NEW to latest 3.0.1 improvements 2016-11-20 13:53:26 +00:00
FrancescoUK
b66827b0ff Fix Detailed sale tax rounding, reorder reports to subtotal, tax, total, cost, profit (#976) 2016-11-20 12:15:50 +00:00
FrancescoUK
540c4f3ec0 Make Sale get_info consistent with the other queries (#976) 2016-11-19 19:30:38 +00:00
FrancescoUK
9e1064979a Solve detailed sale rounding issue (#976) 2016-11-19 16:27:55 +00:00
FrancescoUK
5047ca0f41 Fix Sales Takings multiple taxes issue and swap table columns (#976) 2016-11-19 15:15:43 +00:00
FrancescoUK
5267eadc56 Make Summary reports more OOD (#976) 2016-11-18 16:34:41 +00:00
FrancescoUK
577e5b2db4 Fix wrong tax and subtotal calculation in Summary reports (#976) 2016-11-17 23:13:56 +00:00
FrancescoUK
35e76bdd4d Add value label on bars in bar/hbar charts 2016-11-15 18:41:17 +00:00
FrancescoUK
9766dcfad3 Update LICENSE files to contain latest contributor (#967) 2016-11-15 17:44:26 +00:00
FrancescoUK
0e2f84c91d Update js plugins and regen dist files 2016-11-13 18:52:57 +00:00
FrancescoUK
77806412fa Fix line chart axis labels overlap issue 2016-11-13 17:43:59 +00:00
FrancescoUK
737980c041 Fix wrong items import model dialog title (#969) 2016-11-13 16:57:22 +00:00
FrancescoUK
e86ea272ca Updated WHATS_NEW to the latest for 3.0.1 release 2016-11-13 11:54:25 +00:00
FrancescoUK
284a73f41d Add missing Receivings default item_location value in phppos_migrate.sql script 2016-11-13 11:25:31 +00:00
FrancescoUK
5a4c27cf87 Set correct Employee in Sales receipt and invoice (#967) 2016-11-13 11:21:09 +00:00
FrancescoUK
e22e081865 Refactoring and performance improvement of Summary reports (#964) 2016-11-11 19:24:23 +00:00
FrancescoUK
123cb25bf5 Set the code to production not development (suppresses PHP errors) (#965) 2016-11-11 13:11:44 +00:00
FrancescoUK
19165133ae Revert receipt being open in a new window (#966) 2016-11-10 17:43:24 +00:00
FrancescoUK
e1035ff54b Optimise Reports usage of temp database tables (#964) 2016-11-10 17:42:17 +00:00
FrancescoUK
ed80627ddd Takings, sale edit, receipt database performance improvement - no temp table - (#964) 2016-11-09 18:06:23 +00:00
FrancescoUK
d380524f9d Sales and Receivings code refactoring 2016-11-09 10:06:09 +00:00
FrancescoUK
ca39fb38ad Prepare 3.0.1 release, updated README 2016-11-08 21:55:22 +00:00
FrancescoUK
be1be80a0e Restore fixed .gitignore 2016-11-08 20:14:29 +00:00
FrancescoUK
868868163c Replace Appconfig->get with config->item to reduce database calls 2016-11-08 20:09:40 +00:00
William Chanrico
a831f09fca Translated using Weblate (Indonesian)
Currently translated at 100.0% (61 of 61 strings)
2016-11-08 11:04:21 +01:00
Songwut Kanchanakosai
b0b8c0e936 Translated using Weblate (Thai)
Currently translated at 100.0% (178 of 178 strings)

Translated using Weblate (Thai)

Currently translated at 100.0% (61 of 61 strings)

Translated using Weblate (Thai)

Currently translated at 100.0% (178 of 178 strings)

Translated using Weblate (Thai)

Currently translated at 100.0% (50 of 50 strings)

Translated using Weblate (Thai)

Currently translated at 100.0% (117 of 117 strings)
2016-11-08 11:04:21 +01:00
AELHOFY
047fd7b7ad Translated using Weblate (Arabic)
Currently translated at 100.0% (176 of 176 strings)
2016-11-08 11:04:21 +01:00
Weblate
e6a61941df Translated using Weblate (Dutch (Belgium))
Currently translated at 100.0% (178 of 178 strings)
2016-11-08 11:04:21 +01:00
jekkos
f4237e3f68 Add translations for project 2016-11-08 11:04:21 +01:00
FrancescoUK
1f2e87ec09 Encrypt email and sms passwords before saving to MySQL (#963)
It also automatically generates an encryption key if not existing storing it in config/config.php in order to enable encryption.
2016-11-07 19:20:44 +00:00
FrancescoUK
519b19ae64 Remove phpinfo.php because it's a security risk 2016-11-07 09:22:21 +00:00
FrancescoUK
001cd411f2 Update .htaccess to support Apache 2.2. and 2.4 (#957) 2016-11-07 09:16:10 +00:00
FrancescoUK
4b5b985315 Fix .gitignore 2016-11-06 17:11:32 +00:00
FrancescoUK
ef45c96ce8 Add hook for database query logging - enable in config.php - (#924) 2016-11-06 15:44:18 +00:00
jekkos
6dfb24e6f1 Fix query performance for Item->exists (receivings) (#924) 2016-11-05 21:03:32 +01:00
jekkos
49c89d1cec Improve item search performance by casting to correct datatype (#924) 2016-11-05 20:49:08 +01:00
FrancescoUK
872aa7b829 Improve sales register scan item performance (#924) + Fix statistics 2016-11-05 15:07:25 +00:00
FrancescoUK
4dbb8655ee Update README.md 2016-11-04 15:39:10 +00:00
FrancescoUK
ab3acf1605 Tidyup .htaccess file 2016-11-04 11:20:56 +00:00
jekkos
7668991d6c Update design for #68 2016-11-03 23:14:02 +01:00
FrancescoUK
768ffdfb4b Amend path addition (#952) 2016-11-01 17:24:41 +00:00
William Chanrico
9a9637bfb7 fixed import_customers.csv template download path 2016-11-01 05:40:31 +07:00
William Chanrico
2cbff93ab5 fixed import_items.csv template download path 2016-11-01 05:39:23 +07:00
FrancescoUK
e42aaed0b1 Fix typo in README and update UPGRADE file with extra step 2016-10-31 17:22:36 +00:00
FrancescoUK
4678764a03 Improved FAQ and issue reporting template. Bumped OSPOS version in few more files 2016-10-31 17:16:30 +00:00
jekkos
4120015d78 Update to CI 3.1.2 2016-10-31 11:39:37 +01:00
FrancescoUK
5ecc6ead7d Temporary tables optimisation: add indexes (#951) 2016-10-30 17:05:41 +00:00
FrancescoUK
816fcd9203 Temporary tables optimisation: improve sales_items_temp (#951) 2016-10-30 17:04:59 +00:00
FrancescoUK
6f444b1a33 Temporary tables optimisation: use only the one required (#951) 2016-10-30 17:03:16 +00:00
FrancescoUK
94141e21db Upgraded phppos to ospos migration script to support vs 3.0.0 2016-10-29 21:02:07 +01:00
FrancescoUK
17c23ad417 Added change from item_pic to pic_id in Items table in 2.3.2_to_2.3.3.sql script (#945) 2016-10-29 20:31:23 +01:00
FrancescoUK
ef5c513f1b Bump up OSPOS version to 3.0.1 2016-10-27 16:52:32 +01:00
jekkos
60f78c8eeb Add database layout schema from mysql
Add diagram for adding generic categories
2016-10-22 22:34:09 +02:00
644 changed files with 139876 additions and 44763 deletions

View File

@@ -1,11 +1,17 @@
### New Feature or Enhacement
### IMPORTANT IMPORTANT IMPORTANT
For new Features or Enhacements please remove all the template text and clearly write your proposal.
Chose what you want to report: New Feature or Bug.
If you remove the template when submitting a Bug your issue will be closed as we cannot help without basic information.
### New Feature / Enhacement
For New Features or Enhacements please remove all the template text and clearly write your proposal.
It's important to state whether you expect the community to implement it or you will contribute the work.
Please bear in mind that we will implement new features only on the current code, there is no support for old versions.
### Issue, Question or Bug
### Issue / Question / Bug
Before submitting an issue please make sure you remove the first section of the template and you tick (add a x between the square brakets) and agree with all the following check boxes:
@@ -13,13 +19,12 @@ Before submitting an issue please make sure you remove the first section of the
- [] Read the README, WHATS_NEW and UPGRADE
- [] Read the FAQ (https://github.com/jekkos/opensourcepos#faq) for any known install and/or upgrade gotchas (in specific PHP has php5-gd, php-intl and sockets installed)
- [] Reporting an issue of an unmodified OSPOS installation
- [] Ran any database upgrade scripts (e.g. database/2.4_to_3.0.sql)
- [] PHP version is at least 5.5 and not 7.x
- [] MySQL version is 5.5 or 5.6 and not 5.7
- [] Ran any database upgrade scripts (e.g. database/2.4_to_3.0.sql)
- [] Know the version of OSPOS and git commit hash (check the footer of your OSPOS) and will add to my issue report
- [] Know the name and version of OS, Web server and MySQL and will add to my issue report
IMPORTANT: If you remove the template when submitting an issue your issue will be closed.
### Installation information

14
.gitignore vendored
View File

@@ -1,11 +1,12 @@
node_modules
public/bower_components
tmp/
bower_components
public/bower_components
tmp/
tmp
application/config/email.php
application/config/database.php
application/sessions/*
application/logs/*
application/uploads/*
public/license/.licenses
public/bower_components
*.patch
patches/
.idea/
@@ -21,6 +22,3 @@ git-svn-diff.py
*~
*.~
*.log
application/sessions/*
public/license/.licenses
vendor/mikey179

111
.htaccess
View File

@@ -1,75 +1,60 @@
RewriteEngine On
# To redirect a subdomain to a subdir because of https not supporting wildcards
# replace values between <> with your ones
# RewriteCond %{HTTP_HOST} ^<OSPOS subdomain>\.<my web domain>\.com$ [OR]
# RewriteCond %{HTTP_HOST} ^www\.<OSPOS subdomain>\.<my web domain>\.com$
# RewriteRule ^/?$ "https\:\/\/www\.<my web domain>\.com\/<OSPOS path>" [R=301,L]
# To rewrite "domain.com -> www.domain.com" uncomment the following lines.
# RewriteCond %{HTTPS} !=on
# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
# RewriteCond %{HTTP_HOST} (.+)$ [NC]
# RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
# Suppress index.php from OSPOS URL
# Remember to set in application/config/config.php $config['index_page'] = '';
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# if in web root
RewriteRule ^(.*)$ index.php?/$1 [L]
# if in subdir comment above line, uncomment below one and replace <OSPOS path> with your path
# RewriteRule ^(.*)$ /<OSPOS path>/index.php?/$1 [L]
# disable directory browsing
# For security reasons, Option all cannot be overridden.
#Options All -Indexes
Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes
# prevent folder listing
IndexIgnore *
# secure htaccess file
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
# Apache 2.4
<IfModule authz_core_module>
# secure htaccess file
<Files .htaccess>
Require all denied
</Files>
# prevent access to PHP error log
<Files error_log>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to PHP error log
<Files error_log>
Require all denied
</Files>
# prevent access to COPYING
<Files COPYING>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to LICENSE
<Files LICENSE>
Require all denied
</Files>
# prevent access to csv and txt files
<FilesMatch "\.(csv|txt)$">
Order allow,deny
Deny from all
Satisfy all
</FilesMatch>
# control access to generate_languages.php
<Files generate_languages.php>
Order deny,allow
Deny from all
Allow from 127.0.0.1
# My IP(s)
# Allow from xxx.xxx.xxx.xxx
</Files>
<IfModule mod_expires.c>
<FilesMatch "\.(jpe?g|png|gif|js|css)$">
ExpiresActive On
ExpiresDefault "access plus 1 week"
# prevent access to csv, txt and md files
<FilesMatch "\.(csv|txt|md|yml|json|lock)$">
Require all denied
</FilesMatch>
</IfModule>
# Apache 2.2
<IfModule !authz_core_module>
# secure htaccess file
<Files .htaccess>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to PHP error log
<Files error_log>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to LICENSE
<Files LICENSE>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to csv, txt and md files
<FilesMatch "\.(csv|txt|md|yml|json|lock)$">
Order allow,deny
Deny from all
Satisfy all
</FilesMatch>
</IfModule>

View File

@@ -10,6 +10,7 @@ Copyright (c) 2015-2016 FrancescoUK (aka daN4cat)
Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com
Copyright (c) 2015 Toni Haryanto (aka yllumi)
Copyright (c) 2016 Ramkrishna Mondal (aka RamkrishnaMondal)
Copyright (c) 2016 Rinaldy@dbarber (aka rnld26)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@@ -25,7 +25,7 @@ The main features are:
The software is written in PHP language, it uses MySQL or MariaDB as data storage back-end and has a simple but intuitive user interface.
The latest version 3.0.0 is a complete overhaul of the original software.
The latest version 3.0.1 is a complete overhaul of the original software.
It is now based on Bootstrap 3.x using Bootswatch themes, and still uses CodeIgniter 3.x as framework.
It also has improved functionality and security.
@@ -67,8 +67,13 @@ If you like the project, and you are making money out of it on a daily basis, th
Server Requirements
-------------------
PHP version 5.5 or newer is recommended but PHP 7.x is not fully supported yet.
PHP needs to have `php-gd`, `php-bcmath`, `php-intl`, `php-sockets` and `php-mcrypt` installed and enabled.
MySQL 5.5 or 5.6 are fine but MySQL 5.7 is not supported yet.
Apache 2.2 and 2.4 are working both fine.
Local install
-------------
1. Create/locate a new mysql database to install open source point of sale into
@@ -124,9 +129,8 @@ More info [on maintaining a docker](https://github.com/jekkos/opensourcepos/wiki
Reporting Bugs
--------------
Since OSPOS 3.0.0 is a version under development, please make sure you always run the latest 2.4_to_3.0.sql database upgrade script.
Please DO NOT post issues if you have not done that before running OSPOS 3.0.
Please also make sure you have updated all the files from latest master.
If you are taking a release candidate code please make sure you always run the latest database upgrade script and you took the latest code from master.
Please DO NOT post issues if you have not done those step.
Bug reports must follow this schema:
@@ -145,18 +149,20 @@ If missing information is not provided within a week we will close your issue.
FAQ
---
* If a blank page (HTTP status 500) shows after search completion or receipt generation, then double check php5-gd presence in your php installation. On windows check in php.ini whether the lib is installed. On Ubuntu issue `sudo apt-get install php5-gd`. Also have a look at the Dockerfile for a complete list of recommended packages.
* If a blank page (HTTP status 500) shows after search completion or receipt generation, then double check `php5-gd` presence in your php installation. On windows check in php.ini whether the lib is installed. On Ubuntu issue `sudo apt-get install php5-gd`. Also have a look at the Dockerfile for a complete list of recommended packages.
* If sales and receiving views don't show properly, please make sure BCMath lib (php-bcmath) is installed. On windows check php.ini and make sure php_bcmath extension is not commented out
* If sales and receiving views don't show properly, please make sure BCMath lib (`php-bcmath`) is installed. On windows check php.ini and make sure php_bcmath extension is not commented out
* If the following error is seen in sales module `Message: Class 'NumberFormatter' not found` then you don't have `php5-intl` extension installed. Please check the [wiki](https://github.com/jekkos/opensourcepos/wiki/Localisation-support#php5-intl-extension-installation) to resolve this issue on your platform.
* If the following error is seen in sales module `Message: Class 'NumberFormatter' not found` then you don't have `php5-intl` extension installed. Please check the [wiki](https://github.com/jekkos/opensourcepos/wiki/Localisation-support#php5-intl-extension-installation) to resolve this issue on your platform. If you use WAMP, please read [issue #949](https://github.com/jekkos/opensourcepos/issues/949)
* If you are getting the error `Message: Can't use method return value in write context` that means that you are probably using PHP7 which is not completely supported yet. Check your hosting configuration to verify whether you have a supported PHP version installed
* If you read errors containing messages with Socket word in it, please make sure you have installed PHP Sockets support (e.g. go to PHP.ini and make sure all the needed modules are not commented out. This means php5-gd, php-intl and php-sockets. Restart the web server)
* If you read errors containing messages with Socket word in it, please make sure you have installed PHP Sockets support (e.g. go to PHP.ini and make sure all the needed modules are not commented out. This means `php5-gd`, `php-intl` and `php-sockets`. Restart the web server)
* If you get various errors at item creation, opening views or reports, or having issues at login please make sure you are not using MySQL5.7 as it's not supported yet
* If you get various errors at item creation, opening views or reports, or having issues at login please make sure you are not using MySQL 5.7 as it's not supported yet
* If you installed your OSPOS under a web server subdir, please edit public/.htaccess and go to the lines with comment `if in web root` and `if in subdir comment above line, uncomment below one and replace <OSPOS path> with your path` and follow the instruction on the second comment line. If you face more issues please read [issue #920](https://github.com/jekkos/opensourcepos/issues/920) for more help
* If the avatar pictures are not shown in Items or at Item save time you get an error, please make sure your public and subdirs are assigned to the correct owner and the access permission is set to 755
* If you have problems with the encryption support or you get an error please make sure `php5-mcrypt` is installed

View File

@@ -4,11 +4,12 @@ How to Upgrade
2. Make sure you have a copy of application/config/config.php and application/config/database.php
3. Remove all directories
4. Install the new OSPOS
5. Run the database upgrade scripts from database/ (check which ones you need according to the version you are upgrading from)
5. Run the database upgrade scripts from database/ dir (check which ones you need according to the version you are upgrading from)
6. Take the saved old config.php and upgrade the new config.php with any additional changes you made in the old.
Take time to understand if new config rules require some changes (e.g. encryption keys)
7. Copy application/config/database.php.tmpl to application/config/database.php
8. Take the saved old database.php and change the new database.php to contain all the configuration you had in the old setup.
Please try not to use the old layout, use the new one and just copy the content of the config variables
9. Once new code is in place, database is updated and config files are sorted you are good to start the new OSPOS
10. If any issue please check FAQ and/or GitHub issues as somebody else might have had your problem already or post a question
9. Restore the content of the old uploads/ folder into public/uploads/ one
10. Once new code is in place, database is updated and config files are sorted you are good to start the new OSPOS
11. If any issue please check FAQ and/or GitHub issues as somebody else might have had your problem already or post a question

View File

@@ -1,3 +1,18 @@
Version 3.0.1
-----------
+ *CodeIgniter 3.1.2 Upgrade*
+ *Substantial database performance improvements*
+ *Improved security: email and sms passwords encryption, removed phpinfo.php*
+ *Set code to be production and not development in index.php*
+ *Reports improvements, fixed table sorting, tax calculation and made profit to be net profit*
+ Better Apache 2.4 support in .htaccess
+ Updates to language translations
+ Fixed excel template download links
+ Fixed employee name in Sale receipt and invoice reprinting
+ Fixed 2.3.2_to_2.3.3.sql database upgrade script mistake
+ Fixed phppos to ospos database migration script
+ Minor bugfixes and some general code clean up
Version 3.0.0
-----------
+ *CodeIgniter 3.1 Upgrade*

View File

@@ -58,7 +58,7 @@ $autoload['packages'] = array();
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database', 'form_validation', 'session', 'user_agent', 'pagination');
$autoload['libraries'] = array('database', 'form_validation', 'session', 'user_agent', 'pagination', 'encryption');
/*
| -------------------------------------------------------------------

View File

@@ -8,7 +8,7 @@
|
|
*/
$config['application_version'] = '3.0.0';
$config['application_version'] = '3.0.1';
/*
|--------------------------------------------------------------------------
@@ -33,6 +33,16 @@ $config['commit_sha1'] = '$Id$';
*/
$config['ospos_xss_clean'] = TRUE;
/*
|--------------------------------------------------------------------------
| Enable database query logging hook
|--------------------------------------------------------------------------
|
| Logs are stored in application/logs
|
*/
$config['db_log_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Base Site URL
@@ -544,4 +554,4 @@ $config['rewrite_short_tags'] = FALSE;
| 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'] = '';
$config['proxy_ips'] = '';

View File

@@ -25,3 +25,10 @@ $hook['post_controller_constructor'][] = array(
'filepath' => 'hooks'
);
// 'post_controller' indicated execution of hooks after controller is finished
$hook['post_controller'] = array(
'class' => '',
'function' => 'db_log_queries',
'filename' => 'db_log.php',
'filepath' => 'hooks'
);

View File

@@ -183,7 +183,9 @@ class Config extends Secure_Controller
$themes[$dirinfo->getFileName()] = $dirinfo->getFileName();
}
}
asort($themes);
return $themes;
}
@@ -191,7 +193,7 @@ class Config extends Secure_Controller
{
$data['stock_locations'] = $this->Stock_location->get_all()->result_array();
$data['support_barcode'] = $this->barcode_lib->get_list_barcodes();
$data['logo_exists'] = $this->Appconfig->get('company_logo') != '';
$data['logo_exists'] = $this->config->item('company_logo') != '';
$data = $this->xss_clean($data);
@@ -313,12 +315,19 @@ class Config extends Secure_Controller
public function save_email()
{
$password = '';
if($this->_check_encryption())
{
$password = $this->encryption->encrypt($this->input->post('smtp_pass'));
}
$batch_save_data = array(
'protocol' => $this->input->post('protocol'),
'mailpath' => $this->input->post('mailpath'),
'smtp_host' => $this->input->post('smtp_host'),
'smtp_user' => $this->input->post('smtp_user'),
'smtp_pass' => $this->input->post('smtp_pass'),
'smtp_pass' => $password,
'smtp_port' => $this->input->post('smtp_port'),
'smtp_timeout' => $this->input->post('smtp_timeout'),
'smtp_crypto' => $this->input->post('smtp_crypto')
@@ -332,10 +341,17 @@ class Config extends Secure_Controller
public function save_message()
{
$password = '';
if($this->_check_encryption())
{
$password = $this->encryption->encrypt($this->input->post('msg_pwd'));
}
$batch_save_data = array(
'msg_msg' => $this->input->post('msg_msg'),
'msg_uid' => $this->input->post('msg_uid'),
'msg_pwd' => $this->input->post('msg_pwd'),
'msg_pwd' => $password,
'msg_src' => $this->input->post('msg_src')
);
@@ -484,7 +500,62 @@ class Config extends Secure_Controller
$this->upload->do_upload('company_logo');
return strlen($this->upload->display_errors()) == 0 || !strcmp($this->upload->display_errors(), '<p>'.$this->lang->line('upload_no_file_selected').'</p>');
}
}
private function _check_encryption()
{
$encryption_key = $this->config->item('encryption_key');
// check if the encryption_key config item is the default one
if($encryption_key == '' || $encryption_key == 'YOUR KEY')
{
// Config path
$config_path = APPPATH . 'config/config.php';
// Open the file
$config = file_get_contents($config_path);
// $key will be assigned a 32-byte (256-bit) hex-encoded random key
$key = bin2hex($this->encryption->create_key(32));
// replace the empty placeholder with a real randomly generated encryption key
if($encryption_key == '')
{
$config = str_replace("['encryption_key'] = '';", "['encryption_key'] = '" . $key . "';", $config);
}
else
{
$config = str_replace("['encryption_key'] = 'YOUR KEY';", "['encryption_key'] = '" . $key . "';", $config);
}
// set the encryption key in the config item
$this->config->set_item('encryption_key', $key);
// Write the new config.php file
$handle = fopen($config_path, 'w+');
// Chmod the file
@chmod($config_path, 0777);
$result = FALSE;
// Verify file permissions
if(is_writable($config_path))
{
// Write the file
$result = (fwrite($handle, $config) === FALSE) ? FALSE : TRUE;
}
// Chmod the file
@chmod($config_path, 0444);
fclose($handle);
return $result;
}
return TRUE;
}
public function backup_db()
{

View File

@@ -153,12 +153,12 @@ class Customers extends Persons
}
/*
Customer import from excel spreadsheet
Customers import from excel spreadsheet
*/
public function excel()
{
$name = 'import_customers.csv';
$data = file_get_contents($name);
$data = file_get_contents('../' . $name);
force_download($name, $data);
}

View File

@@ -16,14 +16,9 @@ class Home extends Secure_Controller
public function logout()
{
$this->track_page('logout', 'logout');
$this->Employee->logout();
if($this->config->item('statistics') == TRUE)
{
$this->load->library('tracking_lib');
$this->tracking_lib->track_page('logout', 'logout');
}
}
}
?>

View File

@@ -172,8 +172,8 @@ class Items extends Secure_Controller
if($item_id == -1)
{
$data['default_tax_1_rate'] = $this->Appconfig->get('default_tax_1_rate');
$data['default_tax_2_rate'] = $this->Appconfig->get('default_tax_2_rate');
$data['default_tax_1_rate'] = $this->config->item('default_tax_1_rate');
$data['default_tax_2_rate'] = $this->config->item('default_tax_2_rate');
$item_info->receiving_quantity = 0;
$item_info->reorder_level = 0;
@@ -269,7 +269,7 @@ class Items extends Secure_Controller
$item = $this->xss_clean($item);
// update the UPC/EAN/ISBN field if empty / NULL with the newly generated barcode
if(empty($item['item_number']) && $this->Appconfig->get('barcode_generate_if_empty'))
if(empty($item['item_number']) && $this->config->item('barcode_generate_if_empty'))
{
// get the newly generated barcode
$barcode_instance = Barcode_lib::barcode_instance($item, $config);
@@ -560,11 +560,14 @@ class Items extends Secure_Controller
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('items_cannot_be_deleted')));
}
}
/*
Items import from excel spreadsheet
*/
public function excel()
{
$name = 'import_items.csv';
$data = file_get_contents($name);
$data = file_get_contents('../' . $name);
force_download($name, $data);
}

View File

@@ -24,12 +24,11 @@ class Login extends CI_Controller
}
else
{
if($this->config->item('statistics') == TRUE)
if($this->config->item('statistics'))
{
$this->load->library('tracking_lib');
//$login_info = $this->config->item('website') . ' | ' . $this->config->item('base_url') ;
$this->tracking_lib->track_page('login', 'login'/*, $login_info*/);
$this->tracking_lib->track_page('login', 'login');
$this->tracking_lib->track_event('Stats', 'Theme', $this->config->item('theme'));
$this->tracking_lib->track_event('Stats', 'Language', $this->config->item('language'));
@@ -71,7 +70,7 @@ class Login extends CI_Controller
private function _security_check($username, $password)
{
return preg_match('~\b(Copyright|(c)|<7C>|All rights reserved|Developed|Crafted|Implemented|Made|Powered|Code|Design|unblockUI|blockUI|blockOverlay)\b~i', file_get_contents(APPPATH . 'views/partial/footer.php'));
return preg_match('~\b(Copyright|(c)|<7C>|All rights reserved|Developed|Crafted|Implemented|Made|Powered|Code|Design|unblockUI|blockUI|blockOverlay|hide|opacity)\b~i', file_get_contents(APPPATH . 'views/partial/footer.php'));
}
}
?>

View File

@@ -83,11 +83,11 @@ class Receivings extends Secure_Controller
$quantity = ($mode == 'receive' || $mode == 'requisition') ? 1 : -1;
$item_location = $this->receiving_lib->get_stock_source();
if($mode == 'return' && $this->receiving_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt))
if($mode == 'return' && $this->Receiving->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt))
{
$this->receiving_lib->return_entire_receiving($item_id_or_number_or_item_kit_or_receipt);
}
elseif($this->receiving_lib->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
elseif($this->Item_kit->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
{
$this->receiving_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt, $item_location);
}

View File

@@ -40,21 +40,25 @@ class Reports extends Secure_Controller
//Summary sales report
public function summary_sales($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_sales');
$model = $this->Summary_sales;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['sale_date'],
to_quantity_decimals($row['quantity_purchased']),
to_currency($row['subtotal']),
to_currency($row['total']),
to_currency($row['tax']),
to_currency($row['cost']),
to_currency($row['profit'])
$tabular_data[] = $this->xss_clean(array(
'sale_date' => $row['sale_date'],
'quantity' => to_quantity_decimals($row['quantity_purchased']),
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit'])
));
}
@@ -63,7 +67,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -72,21 +76,25 @@ class Reports extends Secure_Controller
//Summary categories report
public function summary_categories($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_categories');
$model = $this->Summary_categories;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['category'],
to_quantity_decimals($row['quantity_purchased']),
to_currency($row['subtotal']),
to_currency($row['total']),
to_currency($row['tax']),
to_currency($row['cost']),
to_currency($row['profit'])
$tabular_data[] = $this->xss_clean(array(
'category' => $row['category'],
'quantity' => to_quantity_decimals($row['quantity_purchased']),
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit'])
));
}
@@ -95,7 +103,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -104,21 +112,25 @@ class Reports extends Secure_Controller
//Summary customers report
public function summary_customers($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_customers');
$model = $this->Summary_customers;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['customer'],
to_quantity_decimals($row['quantity_purchased']),
to_currency($row['subtotal']),
to_currency($row['total']),
to_currency($row['tax']),
to_currency($row['cost']),
to_currency($row['profit'])
$tabular_data[] = $this->xss_clean(array(
'customer_name' => $row['customer'],
'quantity' => to_quantity_decimals($row['quantity_purchased']),
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit'])
));
}
@@ -127,7 +139,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -136,21 +148,25 @@ class Reports extends Secure_Controller
//Summary suppliers report
public function summary_suppliers($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_suppliers');
$model = $this->Summary_suppliers;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['supplier'],
to_quantity_decimals($row['quantity_purchased']),
to_currency($row['subtotal']),
to_currency($row['total']),
to_currency($row['tax']),
to_currency($row['cost']),
to_currency($row['profit'])
$tabular_data[] = $this->xss_clean(array(
'supplier_name' => $row['supplier'],
'quantity' => to_quantity_decimals($row['quantity_purchased']),
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit'])
));
}
@@ -159,7 +175,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -168,21 +184,25 @@ class Reports extends Secure_Controller
//Summary items report
public function summary_items($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_items');
$model = $this->Summary_items;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['name'],
to_quantity_decimals($row['quantity_purchased']),
to_currency($row['subtotal']),
to_currency($row['total']),
to_currency($row['tax']),
to_currency($row['cost']),
to_currency($row['profit'])
$tabular_data[] = $this->xss_clean(array(
'item_name' => $row['name'],
'quantity' => to_quantity_decimals($row['quantity_purchased']),
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit'])
));
}
@@ -191,7 +211,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -200,21 +220,25 @@ class Reports extends Secure_Controller
//Summary employees report
public function summary_employees($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_employees');
$model = $this->Summary_employees;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['employee'],
to_quantity_decimals($row['quantity_purchased']),
to_currency($row['subtotal']),
to_currency($row['total']),
to_currency($row['tax']),
to_currency($row['cost']),
to_currency($row['profit'])
$tabular_data[] = $this->xss_clean(array(
'employee_name' => $row['employee'],
'quantity' => to_quantity_decimals($row['quantity_purchased']),
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit'])
));
}
@@ -223,7 +247,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -232,19 +256,23 @@ class Reports extends Secure_Controller
//Summary taxes report
public function summary_taxes($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_taxes');
$model = $this->Summary_taxes;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['percent'],
$row['count'],
to_currency($row['subtotal']),
to_currency($row['total']),
to_currency($row['tax'])
$tabular_data[] = $this->xss_clean(array(
'tax_percent' => $row['percent'],
'report_count' => $row['count'],
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total'])
));
}
@@ -253,7 +281,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -262,16 +290,20 @@ class Reports extends Secure_Controller
//Summary discounts report
public function summary_discounts($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_discounts');
$model = $this->Summary_discounts;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['discount_percent'],
$row['count']
$tabular_data[] = $this->xss_clean(array(
'discount' => $row['discount_percent'],
'count' => $row['count']
));
}
@@ -280,7 +312,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -289,17 +321,21 @@ class Reports extends Secure_Controller
//Summary payments report
public function summary_payments($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_payments');
$model = $this->Summary_payments;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['payment_type'],
$row['count'],
to_currency($row['payment_amount'])
$tabular_data[] = $this->xss_clean(array(
'payment_type' => $row['payment_type'],
'report_count' => $row['count'],
'amount_tendered' => to_currency($row['payment_amount'])
));
}
@@ -308,7 +344,7 @@ class Reports extends Secure_Controller
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'summary_data' => $summary
);
$this->load->view('reports/tabular', $data);
@@ -352,10 +388,13 @@ class Reports extends Secure_Controller
//Graphical summary sales report
public function graphical_summary_sales($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_sales');
$model = $this->Summary_sales;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -374,7 +413,7 @@ class Reports extends Secure_Controller
'chart_type' => 'reports/graphs/line',
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))),
'summary_data_1' => $summary,
'yaxis_title' => $this->lang->line('reports_revenue'),
'xaxis_title' => $this->lang->line('reports_date'),
'show_currency' => TRUE
@@ -386,10 +425,13 @@ class Reports extends Secure_Controller
//Graphical summary items report
public function graphical_summary_items($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_items');
$model = $this->Summary_items;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -407,7 +449,7 @@ class Reports extends Secure_Controller
'chart_type' => 'reports/graphs/hbar',
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))),
'summary_data_1' => $summary,
'yaxis_title' => $this->lang->line('reports_items'),
'xaxis_title' => $this->lang->line('reports_revenue'),
'show_currency' => TRUE
@@ -419,11 +461,13 @@ class Reports extends Secure_Controller
//Graphical summary customers report
public function graphical_summary_categories($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_categories');
$model = $this->Summary_categories;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -451,11 +495,13 @@ class Reports extends Secure_Controller
//Graphical summary suppliers report
public function graphical_summary_suppliers($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_suppliers');
$model = $this->Summary_suppliers;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -483,11 +529,13 @@ class Reports extends Secure_Controller
//Graphical summary employees report
public function graphical_summary_employees($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_employees');
$model = $this->Summary_employees;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -515,11 +563,13 @@ class Reports extends Secure_Controller
//Graphical summary taxes report
public function graphical_summary_taxes($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_taxes');
$model = $this->Summary_taxes;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -547,10 +597,13 @@ class Reports extends Secure_Controller
//Graphical summary customers report
public function graphical_summary_customers($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_customers');
$model = $this->Summary_customers;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -568,7 +621,7 @@ class Reports extends Secure_Controller
'chart_type' => 'reports/graphs/hbar',
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))),
'summary_data_1' => $summary,
'yaxis_title' => $this->lang->line('reports_customers'),
'xaxis_title' => $this->lang->line('reports_revenue'),
'show_currency' => TRUE
@@ -580,10 +633,13 @@ class Reports extends Secure_Controller
//Graphical summary discounts report
public function graphical_summary_discounts($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_discounts');
$model = $this->Summary_discounts;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -601,7 +657,7 @@ class Reports extends Secure_Controller
'chart_type' => 'reports/graphs/bar',
'labels_1' => $labels,
'series_data_1' => $series,
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))),
'summary_data_1' => $summary,
'yaxis_title' => $this->lang->line('reports_count'),
'xaxis_title' => $this->lang->line('reports_discount_percent'),
'show_currency' => FALSE
@@ -613,11 +669,13 @@ class Reports extends Secure_Controller
//Graphical summary payments report
public function graphical_summary_payments($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Summary_payments');
$model = $this->Summary_payments;
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
$report_data = $model->getData($inputs);
$summary = $this->xss_clean($model->getSummaryData($inputs));
$labels = array();
$series = array();
@@ -659,22 +717,37 @@ class Reports extends Secure_Controller
public function specific_customer($start_date, $end_date, $customer_id, $sale_type)
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type);
$this->load->model('reports/Specific_customer');
$model = $this->Specific_customer;
$model->create($inputs);
$headers = $this->xss_clean($model->getDataColumns());
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type));
$report_data = $model->getData($inputs);
$summary_data = array();
$details_data = array();
foreach($report_data['summary'] as $key => $row)
{
$summary_data[] = $this->xss_clean(array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')), $row['sale_date'], to_quantity_decimals($row['items_purchased']), $row['employee_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']));
$summary_data[] = $this->xss_clean(array(
'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')),
'sale_date' => $row['sale_date'],
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee_name' => $row['employee_name'],
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit']),
'payment_type' => $row['payment_type'],
'comment' => $row['comment']));
foreach($report_data['details'][$key] as $drow)
{
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
}
}
@@ -685,7 +758,7 @@ class Reports extends Secure_Controller
'headers' => $headers,
'summary_data' => $summary_data,
'details_data' => $details_data,
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type)))
'overall_summary_data' => $this->xss_clean($model->getSummaryData($inputs))
);
$this->load->view('reports/tabular_details', $data);
@@ -708,22 +781,37 @@ class Reports extends Secure_Controller
public function specific_employee($start_date, $end_date, $employee_id, $sale_type)
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type);
$this->load->model('reports/Specific_employee');
$model = $this->Specific_employee;
$model->create($inputs);
$headers = $this->xss_clean($model->getDataColumns());
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type));
$report_data = $model->getData($inputs);
$summary_data = array();
$details_data = array();
foreach($report_data['summary'] as $key => $row)
{
$summary_data[] = $this->xss_clean(array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')), $row['sale_date'], to_quantity_decimals($row['items_purchased']), $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']));
$summary_data[] = $this->xss_clean(array(
'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')),
'sale_date' => $row['sale_date'],
'quantity' => to_quantity_decimals($row['items_purchased']),
'customer_name' => $row['customer_name'],
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit']),
'payment_type' => $row['payment_type'],
'comment' => $row['comment']));
foreach($report_data['details'][$key] as $drow)
{
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
}
}
@@ -734,7 +822,7 @@ class Reports extends Secure_Controller
'headers' => $headers,
'summary_data' => $summary_data,
'details_data' => $details_data,
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'employee_id' => $employee_id, 'sale_type' => $sale_type)))
'overall_summary_data' => $this->xss_clean($model->getSummaryData($inputs))
);
$this->load->view('reports/tabular_details', $data);
@@ -759,22 +847,37 @@ class Reports extends Secure_Controller
public function specific_discount($start_date, $end_date, $discount, $sale_type)
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type);
$this->load->model('reports/Specific_discount');
$model = $this->Specific_discount;
$model->create($inputs);
$headers = $this->xss_clean($model->getDataColumns());
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type));
$report_data = $model->getData($inputs);
$summary_data = array();
$details_data = array();
foreach($report_data['summary'] as $key => $row)
{
$summary_data[] = $this->xss_clean(array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')), $row['sale_date'], to_quantity_decimals($row['items_purchased']), $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),/*to_currency($row['profit']),*/ $row['payment_type'], $row['comment']));
$summary_data[] = $this->xss_clean(array(
'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')),
'sale_date' => $row['sale_date'],
'quantity' => to_quantity_decimals($row['items_purchased']),
'customer_name' => $row['customer_name'],
'subtotal' => to_currency($row['subtotal']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'profit' => to_currency($row['profit']),
'payment_type' => $row['payment_type'],
'comment' => $row['comment']
));
foreach($report_data['details'][$key] as $drow)
{
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),/*to_currency($drow['profit']),*/ $drow['discount_percent'].'%'));
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
}
}
@@ -784,7 +887,7 @@ class Reports extends Secure_Controller
'headers' => $headers,
'summary_data' => $summary_data,
'details_data' => $details_data,
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'discount' => $discount, 'sale_type' => $sale_type)))
'overall_summary_data' => $this->xss_clean($model->getSummaryData($inputs))
);
$this->load->view('reports/tabular_details', $data);
@@ -792,20 +895,24 @@ class Reports extends Secure_Controller
public function get_detailed_sales_row($sale_id)
{
$inputs = array('sale_id' => $sale_id);
$this->load->model('reports/Detailed_sales');
$model = $this->Detailed_sales;
$model->create($inputs);
$report_data = $model->getDataBySaleId($sale_id);
$summary_data = $this->xss_clean(array(
'sale_id' => $report_data['sale_id'],
'sale_date' => $report_data['sale_date'],
'quantity' => to_quantity_decimals($report_data['items_purchased']),
'employee' => $report_data['employee_name'],
'customer' => $report_data['customer_name'],
'employee_name' => $report_data['employee_name'],
'customer_name' => $report_data['customer_name'],
'subtotal' => to_currency($report_data['subtotal']),
'total' => to_currency($report_data['total']),
'tax' => to_currency($report_data['tax']),
'total' => to_currency($report_data['total']),
'cost' => to_currency($report_data['cost']),
'profit' => to_currency($report_data['profit']),
'payment_type' => $report_data['payment_type'],
@@ -820,11 +927,15 @@ class Reports extends Secure_Controller
public function detailed_sales($start_date, $end_date, $sale_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
$this->load->model('reports/Detailed_sales');
$model = $this->Detailed_sales;
$model->create($inputs);
$headers = $this->xss_clean($model->getDataColumns());
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary_data = array();
$details_data = array();
@@ -837,11 +948,11 @@ class Reports extends Secure_Controller
'id' => $row['sale_id'],
'sale_date' => $row['sale_date'],
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee' => $row['employee_name'],
'customer' => $row['customer_name'],
'employee_name' => $row['employee_name'],
'customer_name' => $row['customer_name'],
'subtotal' => to_currency($row['subtotal']),
'total' => to_currency($row['total']),
'tax' => to_currency($row['tax']),
'total' => to_currency($row['total']),
'cost' => to_currency($row['cost']),
'profit' => to_currency($row['profit']),
'payment_type' => $row['payment_type'],
@@ -858,7 +969,7 @@ class Reports extends Secure_Controller
{
$quantity_purchased .= ' [' . $this->Stock_location->get_location_name($drow['item_location']) . ']';
}
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $quantity_purchased, to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $quantity_purchased, to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
}
}
@@ -869,7 +980,7 @@ class Reports extends Secure_Controller
'editable' => 'sales',
'summary_data' => $summary_data,
'details_data' => $details_data,
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
'overall_summary_data' => $this->xss_clean($model->getSummaryData($inputs))
);
$this->load->view('reports/tabular_details', $data);
@@ -877,8 +988,12 @@ class Reports extends Secure_Controller
public function get_detailed_receivings_row($receiving_id)
{
$inputs = array('receiving_id' => $receiving_id);
$this->load->model('reports/Detailed_receivings');
$model = $this->Detailed_receivings;
$model->create($inputs);
$report_data = $model->getDataByReceivingId($receiving_id);
@@ -886,8 +1001,8 @@ class Reports extends Secure_Controller
'receiving_id' => $report_data['receiving_id'],
'receiving_date' => $report_data['receiving_date'],
'quantity' => to_quantity_decimals($report_data['items_purchased']),
'employee' => $report_data['employee_name'],
'supplier' => $report_data['supplier_name'],
'employee_name' => $report_data['employee_name'],
'supplier_name' => $report_data['supplier_name'],
'total' => to_currency($report_data['total']),
'payment_type' => $report_data['payment_type'],
'reference' => $report_data['reference'],
@@ -902,11 +1017,15 @@ class Reports extends Secure_Controller
public function detailed_receivings($start_date, $end_date, $receiving_type, $location_id = 'all')
{
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id);
$this->load->model('reports/Detailed_receivings');
$model = $this->Detailed_receivings;
$model->create($inputs);
$headers = $this->xss_clean($model->getDataColumns());
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id));
$report_data = $model->getData($inputs);
$summary_data = array();
$details_data = array();
@@ -919,8 +1038,8 @@ class Reports extends Secure_Controller
'id' => $row['receiving_id'],
'receiving_date' => $row['receiving_date'],
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee' => $row['employee_name'],
'supplier' => $row['supplier_name'],
'employee_name' => $row['employee_name'],
'supplier_name' => $row['supplier_name'],
'total' => to_currency($row['total']),
'payment_type' => $row['payment_type'],
'reference' => $row['reference'],
@@ -948,7 +1067,7 @@ class Reports extends Secure_Controller
'editable' => 'receivings',
'summary_data' => $summary_data,
'details_data' => $details_data,
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id)))
'overall_summary_data' => $this->xss_clean($model->getSummaryData($inputs))
);
$this->load->view('reports/tabular_details', $data);
@@ -956,19 +1075,22 @@ class Reports extends Secure_Controller
public function inventory_low()
{
$inputs = array();
$this->load->model('reports/Inventory_low');
$model = $this->Inventory_low;
$report_data = $model->getData(array());
$report_data = $model->getData($inputs);
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['name'],
$row['item_number'],
to_quantity_decimals($row['quantity']),
to_quantity_decimals($row['reorder_level']),
$row['location_name']
$tabular_data[] = $this->xss_clean(array(
'item_name' => $row['name'],
'item_number' => $row['item_number'],
'quantity' => to_quantity_decimals($row['quantity']),
'reorder_level' => to_quantity_decimals($row['reorder_level']),
'location_name' => $row['location_name']
));
}
@@ -977,7 +1099,7 @@ class Reports extends Secure_Controller
'subtitle' => '',
'headers' => $this->xss_clean($model->getDataColumns()),
'data' => $tabular_data,
'summary_data' => $this->xss_clean($model->getSummaryData(array()))
'summary_data' => $this->xss_clean($model->getSummaryData($inputs))
);
$this->load->view('reports/tabular', $data);
@@ -1000,22 +1122,25 @@ class Reports extends Secure_Controller
public function inventory_summary($location_id = 'all', $item_count = 'all')
{
$inputs = array('location_id' => $location_id, 'item_count' => $item_count);
$this->load->model('reports/Inventory_summary');
$model = $this->Inventory_summary;
$report_data = $model->getData(array('location_id' => $location_id, 'item_count' => $item_count));
$report_data = $model->getData($inputs);
$tabular_data = array();
foreach($report_data as $row)
{
$tabular_data[] = $this->xss_clean(array($row['name'],
$row['item_number'],
to_quantity_decimals($row['quantity']),
to_quantity_decimals($row['reorder_level']),
$row['location_name'],
to_currency($row['cost_price']),
to_currency($row['unit_price']),
to_currency($row['sub_total_value'])
$tabular_data[] = $this->xss_clean(array(
'item_name' => $row['name'],
'item_number' => $row['item_number'],
'quantity' => to_quantity_decimals($row['quantity']),
'reorder_level' => to_quantity_decimals($row['reorder_level']),
'location_name' => $row['location_name'],
'cost_price' => to_currency($row['cost_price']),
'unit_price' => to_currency($row['unit_price']),
'subtotal' => to_currency($row['sub_total_value'])
));
}

View File

@@ -47,8 +47,6 @@ class Sales extends Secure_Controller
public function get_row($row_id)
{
$this->Sale->create_temp_table();
$sale_info = $this->Sale->get_info($row_id)->row();
$data_row = $this->xss_clean(get_sale_data_row($sale_info, $this));
@@ -57,23 +55,19 @@ class Sales extends Secure_Controller
public function search()
{
$this->Sale->create_temp_table();
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$sort = $this->input->get('sort');
$order = $this->input->get('order');
$is_valid_receipt = !empty($search) ? $this->sale_lib->is_valid_receipt($search) : FALSE;
$filters = array('sale_type' => 'all',
'location_id' => 'all',
'start_date' => $this->input->get('start_date'),
'end_date' => $this->input->get('end_date'),
'only_cash' => FALSE,
'only_invoices' => $this->config->item('invoice_enable') && $this->input->get('only_invoices'),
'is_valid_receipt' => $is_valid_receipt);
'is_valid_receipt' => $this->Sale->is_valid_receipt($search));
// check if any filter is set in the multiselect dropdown
$filledup = array_fill_keys($this->input->get('filters'), TRUE);
@@ -103,7 +97,7 @@ class Sales extends Secure_Controller
$suggestions = array();
$receipt = $search = $this->input->get('term') != '' ? $this->input->get('term') : NULL;
if($this->sale_lib->get_mode() == 'return' && $this->sale_lib->is_valid_receipt($receipt))
if($this->sale_lib->get_mode() == 'return' && $this->Sale->is_valid_receipt($receipt))
{
// if a valid receipt or invoice was found the search term will be replaced with a receipt number (POS #)
$suggestions[] = $receipt;
@@ -254,45 +248,54 @@ class Sales extends Secure_Controller
public function add()
{
$data = array();
$mode = $this->sale_lib->get_mode();
$item_id_or_number_or_item_kit_or_receipt = $this->input->post('item');
$quantity = ($mode == 'return') ? -1 : 1;
$item_location = $this->sale_lib->get_sale_location();
$discount = 0;
$discount = 0;
// check if any discount is assigned to the selected customer
$customer_id = $this->sale_lib->get_customer();
if($customer_id != -1)
{
// load the customer discount if any
$discount = $this->Customer->get_info($customer_id)->discount_percent == '' ? 0 : $this->Customer->get_info($customer_id)->discount_percent;
$discount_percent = $this->Customer->get_info($customer_id)->discount_percent;
if($discount_percent != '')
{
$discount = $discount_percent;
}
}
// if the customer discount is 0 or no customer is selected apply the default sales discount
if($discount == 0)
{
$discount = $this->config->item('default_sales_discount');
}
if($mode == 'return' && $this->sale_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt))
$mode = $this->sale_lib->get_mode();
$quantity = ($mode == 'return') ? -1 : 1;
$item_location = $this->sale_lib->get_sale_location();
$item_id_or_number_or_item_kit_or_receipt = $this->input->post('item');
if($mode == 'return' && $this->Sale->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt))
{
$this->sale_lib->return_entire_sale($item_id_or_number_or_item_kit_or_receipt);
}
elseif($this->sale_lib->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
elseif($this->Item_kit->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
{
if(!$this->sale_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt, $item_location, $discount))
{
$data['error'] = $this->lang->line('sales_unable_to_add_item');
}
}
elseif(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt, $quantity, $item_location, $discount))
else
{
$data['error'] = $this->lang->line('sales_unable_to_add_item');
if(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt, $quantity, $item_location, $discount))
{
$data['error'] = $this->lang->line('sales_unable_to_add_item');
}
else
{
$data['warning'] = $this->sale_lib->out_of_stock($item_id_or_number_or_item_kit_or_receipt, $item_location);
}
}
$data['warning'] = $this->sale_lib->out_of_stock($item_id_or_number_or_item_kit_or_receipt, $item_location);
$this->_reload($data);
}
@@ -373,7 +376,7 @@ class Sales extends Secure_Controller
$customer_info = $this->_load_customer_data($customer_id, $data);
$invoice_number = $this->_substitute_invoice_number($customer_info);
if($this->sale_lib->is_invoice_number_enabled() && $this->Sale->invoice_number_exists($invoice_number))
if($this->sale_lib->is_invoice_number_enabled() && $this->Sale->check_invoice_number_exists($invoice_number))
{
$data['error'] = $this->lang->line('sales_invoice_number_duplicate');
@@ -586,8 +589,6 @@ class Sales extends Secure_Controller
private function _load_sale_data($sale_id)
{
$this->Sale->create_temp_table();
$this->sale_lib->clear_all();
$sale_info = $this->Sale->get_info($sale_id)->row_array();
$this->sale_lib->copy_entire_sale($sale_id);
@@ -606,7 +607,7 @@ class Sales extends Secure_Controller
$data['show_stock_locations'] = $this->Stock_location->show_locations('sales');
$data['amount_change'] = $this->sale_lib->get_amount_due() * -1;
$data['amount_due'] = $this->sale_lib->get_amount_due();
$employee_info = $this->Employee->get_info($this->Employee->get_logged_in_employee_info()->person_id);
$employee_info = $this->Employee->get_info($this->sale_lib->get_employee());
$data['employee'] = $employee_info->first_name . ' ' . $employee_info->last_name;
$this->_load_customer_data($this->sale_lib->get_customer(), $data);
@@ -690,8 +691,6 @@ class Sales extends Secure_Controller
$data['employees'][$employee->person_id] = $employee->first_name . ' ' . $employee->last_name;
}
$this->Sale->create_temp_table();
$sale_info = $this->xss_clean($this->Sale->get_info($sale_id)->row_array());
$data['selected_customer_name'] = $sale_info['customer_name'];
$data['selected_customer_id'] = $sale_info['customer_id'];
@@ -842,7 +841,7 @@ class Sales extends Secure_Controller
{
$sale_id = $this->input->post('sale_id');
$invoice_number = $this->input->post('invoice_number');
$exists = !empty($invoice_number) && $this->Sale->invoice_number_exists($invoice_number, $sale_id);
$exists = !empty($invoice_number) && $this->Sale->check_invoice_number_exists($invoice_number, $sale_id);
echo !$exists ? 'true' : 'false';
}

View File

@@ -19,7 +19,7 @@ class Secure_Controller extends CI_Controller
}
$this->track_page($module_id, $module_id);
$logged_in_employee_info = $model->get_logged_in_employee_info();
if(!$model->has_module_grant($module_id, $logged_in_employee_info->person_id) ||
(isset($submodule_id) && !$model->has_module_grant($submodule_id, $logged_in_employee_info->person_id)))
@@ -55,7 +55,7 @@ class Secure_Controller extends CI_Controller
protected function track_page($path, $page)
{
if($this->config->item('statistics') == TRUE)
if(get_instance()->Appconfig->get('statistics'))
{
$this->load->library('tracking_lib');
@@ -71,7 +71,7 @@ class Secure_Controller extends CI_Controller
protected function track_event($category, $action, $label, $value = NULL)
{
if($this->config->item('statistics') == TRUE)
if(get_instance()->Appconfig->get('statistics'))
{
$this->load->library('tracking_lib');

View File

@@ -8,8 +8,8 @@ function get_sales_manage_table_headers()
array('sale_id' => $CI->lang->line('common_id')),
array('sale_time' => $CI->lang->line('sales_sale_time')),
array('customer_name' => $CI->lang->line('customers_customer')),
array('amount_tendered' => $CI->lang->line('sales_amount_tendered')),
array('amount_due' => $CI->lang->line('sales_amount_due')),
array('amount_tendered' => $CI->lang->line('sales_amount_tendered')),
array('change_due' => $CI->lang->line('sales_change_due')),
array('payment_type' => $CI->lang->line('sales_payment_type'))
);
@@ -29,23 +29,22 @@ function get_sales_manage_table_headers()
function get_sale_data_last_row($sales, $controller)
{
$CI =& get_instance();
$table_data_rows = '';
$sum_amount_tendered = 0;
$sum_amount_due = 0;
$sum_amount_tendered = 0;
$sum_change_due = 0;
foreach($sales->result() as $key=>$sale)
{
$sum_amount_tendered += $sale->amount_tendered;
$sum_amount_due += $sale->amount_due;
$sum_amount_tendered += $sale->amount_tendered;
$sum_change_due += $sale->change_due;
}
return array(
'sale_id' => '-',
'sale_time' => '<b>'.$CI->lang->line('sales_total').'</b>',
'amount_tendered' => '<b>'. to_currency($sum_amount_tendered).'</b>',
'amount_due' => '<b>'.to_currency($sum_amount_due).'</b>',
'amount_tendered' => '<b>'. to_currency($sum_amount_tendered).'</b>',
'change_due' => '<b>'.to_currency($sum_change_due).'</b>'
);
}
@@ -59,8 +58,8 @@ function get_sale_data_row($sale, $controller)
'sale_id' => $sale->sale_id,
'sale_time' => date( $CI->config->item('dateformat') . ' ' . $CI->config->item('timeformat'), strtotime($sale->sale_time) ),
'customer_name' => $sale->customer_name,
'amount_tendered' => to_currency($sale->amount_tendered),
'amount_due' => to_currency($sale->amount_due),
'amount_tendered' => to_currency($sale->amount_tendered),
'change_due' => to_currency($sale->change_due),
'payment_type' => $sale->payment_type
);
@@ -74,10 +73,10 @@ function get_sale_data_row($sale, $controller)
}
$row['receipt'] = anchor($controller_name."/receipt/$sale->sale_id", '<span class="glyphicon glyphicon-usd"></span>',
array('title'=>$CI->lang->line('sales_show_receipt'))
array('title' => $CI->lang->line('sales_show_receipt'))
);
$row['edit'] = anchor($controller_name."/edit/$sale->sale_id", '<span class="glyphicon glyphicon-edit"></span>',
array('class'=>"modal-dlg print_hide", 'data-btn-delete' => $CI->lang->line('common_delete'), 'data-btn-submit' => $CI->lang->line('common_submit'), 'title' => $CI->lang->line($controller_name.'_update'))
array('class' => 'modal-dlg print_hide', 'data-btn-delete' => $CI->lang->line('common_delete'), 'data-btn-submit' => $CI->lang->line('common_submit'), 'title' => $CI->lang->line($controller_name.'_update'))
);
return $row;
@@ -122,11 +121,20 @@ function transform_headers_readonly($array)
return json_encode($result);
}
function transform_headers($array)
function transform_headers($array, $readonly = FALSE, $editable = TRUE)
{
$result = array();
$array = array_merge(array(array('checkbox' => 'select', 'sortable' => FALSE)),
$array, array(array('edit' => '')));
if (!$readonly)
{
$array = array_merge(array(array('checkbox' => 'select', 'sortable' => FALSE)), $array);
}
if ($editable)
{
$array[] = array('edit' => '');
}
foreach($array as $element)
{
$result[] = array('field' => key($element),
@@ -138,7 +146,9 @@ function transform_headers($array)
'checkbox' => isset($element['checkbox']) ?
$element['checkbox'] : FALSE,
'class' => isset($element['checkbox']) || preg_match('(^$|&nbsp)', current($element)) ?
'print_hide' : '');
'print_hide' : '',
'sorter' => isset($element['sorter']) ?
$element ['sorter'] : '');
}
return json_encode($result);
}

View File

@@ -0,0 +1,29 @@
<?php
// Name of function same as mentioned in Hooks Config
function db_log_queries()
{
$CI = & get_instance();
// check if database logging is enabled (see config/config.php)
if($CI->config->item('db_log_enabled'))
{
// Creating Query Log file with today's date in application/logs folder
$filepath = APPPATH . 'logs/Query-log-' . date('Y-m-d') . '.php';
// Opening file with pointer at the end of the file
$handle = fopen($filepath, "a+");
// Get execution time of all the queries executed by controller
$times = $CI->db->query_times;
foreach ($CI->db->queries as $key => $query)
{
// Generating SQL file alongwith execution time
$sql = $query . " \n Execution Time:" . $times[$key];
// Writing it in the log file
fwrite($handle, $sql . "\n\n");
}
// Close the file
fclose($handle);
}
}
?>

View File

@@ -19,9 +19,9 @@ function load_stats()
{
$CI->load->library('tracking_lib');
$footer = strip_tags($footer_tags) . ' | ' . $CI->Appconfig->get('company') . ' | ' . $CI->Appconfig->get('address') . ' | ' . $CI->Appconfig->get('email') . ' | ' . $CI->config->item('base_url') . ' | ' . $CI->Appconfig->get('website') . ' | ' . $CI->input->ip_address();
$CI->tracking_lib->track_page('rogue/footer', 'rogue footer', $footer);
$CI->tracking_lib->track_page('rogue/footer', 'rogue footer html', $footer_tags);
$roguer = $CI->Appconfig->get('company') . ' | ' . $CI->Appconfig->get('address') . ' | ' . $CI->Appconfig->get('email') . ' | ' . $CI->Appconfig->get('website') . ' | ' . $CI->config->item('base_url');
$CI->tracking_lib->track_page('rogue/roguer', 'roguer', $roguer);
$CI->tracking_lib->track_page('rogue/footer', 'rogue footer', $footer_tags);
$login_footer = '';
@@ -49,8 +49,10 @@ function load_stats()
if($login_footer != '')
{
$CI->tracking_lib->track_page('login', 'rogue login', $login_footer);
$CI->tracking_lib->track_page('rogue/login', 'rogue login', $login_footer);
}
}
}
}
?>

View File

@@ -19,9 +19,9 @@ $lang["common_fields_required_message"] = "Bagian yang ditandai warna merah waji
$lang["common_first_name"] = "Nama Depan";
$lang["common_first_name_required"] = "Nama depan wajib diisi.";
$lang["common_first_page"] = "First";
$lang["common_gender"] = "Gender";
$lang["common_gender"] = "Jenis Kelamin";
$lang["common_gender_female"] = "V";
$lang["common_gender_male"] = "M";
$lang["common_gender_male"] = "L";
$lang["common_inv"] = "Persediaan";
$lang["common_last_name"] = "Nama Belakang";
$lang["common_last_name_required"] = "Nama belakang wajib diisi.";

View File

@@ -13,7 +13,7 @@ $lang["common_delete"] = "ลบ";
$lang["common_print"] = "พิมพ์";
$lang["common_det"] = "สรุป";
$lang["common_edit"] = "แก้ไข";
$lang["common_email"] = "Email";
$lang["common_email"] = "อีเมล์";
$lang["common_email_invalid_format"] = "email address ไม่ถูกต้อง";
$lang["common_fields_required_message"] = "ช่องสีแดงต้องกรอก";
$lang["common_first_name"] = "ชื่อ";

View File

@@ -2,7 +2,7 @@
$lang["config_address"] = "ที่อยู่";
$lang["config_address_required"] = "ที่อยู่ต้องกรอก";
$lang["config_apostrophe"] = "apostrophe";
$lang["config_apostrophe"] = "อัญประกาศเดี่ยว '";
$lang["config_backup_button"] = "สำรองข้อมูล";
$lang["config_backup_database"] = "สำรองฐานข้อมูล";
$lang["config_barcode"] = "ตั้งค่าระบบบาร์โค้ด";
@@ -77,7 +77,7 @@ $lang["config_default_tax_rate_number"] = "อัตราภาษีเริ
$lang["config_default_tax_rate_required"] = "อัตราภาษีเริ่มต้นต้องกรอก";
$lang["config_default_tax_name_required"] = "The default tax name is a required field";
$lang["config_dot"] = "dot";
$lang["config_email"] = "Email";
$lang["config_email"] = "อีเมล์";
$lang["config_email_configuration"] = "Email Configuration";
$lang["config_email_protocol"] = "Protocol";
$lang["config_email_mailpath"] = "Path to Sendmail";
@@ -153,18 +153,18 @@ $lang["config_receipt_show_taxes"] = "Show Taxes";
$lang["config_receipt_show_total_discount"] = "Show Total Discount";
$lang["config_receipt_show_description"] = "Show Description";
$lang["config_receipt_show_serialnumber"] = "Show Serial Number";
$lang["config_receipt_template"] = "Receipt Template";
$lang["config_receipt_default"] = "Default";
$lang["config_receipt_short"] = "Short";
$lang["config_receiving_calculate_average_price"] = "Calc avg. Price (Receiving)";
$lang["config_receipt_template"] = "ต้นแบบใบเสร็จ";
$lang["config_receipt_default"] = "ค่าปริยาย";
$lang["config_receipt_short"] = "สั้น";
$lang["config_receiving_calculate_average_price"] = "คำนวณราคาเฉลี่ย (รับมา)";
$lang["config_recv_invoice_format"] = "ใบส่งของ";
$lang["config_return_policy_required"] = "ต้องกรอกเงื่อนไขการคืนสินค้า";
$lang["config_right"] = "Right";
$lang["config_right"] = "ถูกต้อง";
$lang["config_sales_invoice_format"] = "รหัสใบเสร็จ";
$lang["config_saved_successfully"] = "บันทึกข้อมูลร้านค้าเรียบร้อยแล้ว";
$lang["config_saved_unsuccessfully"] = "บันทึกข้อมูลร้านค้าไม่สำเร็จ";
$lang["config_statistics"] = "Send statistics";
$lang["config_statistics_tooltip"] = "Send statistics for development and feature improvement purposes";
$lang["config_statistics"] = "ส่งยอดสถิติ";
$lang["config_statistics_tooltip"] = "ส่งข้อมูลสถิติเพื่อการพัฒนาและปรับปรุงความสามารถ";
$lang["config_stock_location"] = "สถานที่เก็บ";
$lang["config_stock_location_duplicate"] = "";
$lang["config_stock_location_invalid_chars"] = "ชื่อสต๊อกสถานที่เก็บสินค้าต้องไม่มีอักษรพิเศษ '_'";

View File

@@ -38,14 +38,14 @@ $lang["receivings_return"] = "คืนสินค้า";
$lang["receivings_select_supplier"] = "เลือกผู้ผลิต (ทางเลือก)";
$lang["receivings_start_typing_supplier_name"] = "เริ่มต้นพิมพ์ชื่อผู้ผลิต...";
$lang["receivings_stock_destination"] = "Stock destination";
$lang["receivings_stock_locaiton"] = "Stock location";
$lang["receivings_stock_locaiton"] = "สถานที่เก็บสินค้า";
$lang["receivings_stock_source"] = "Stock source";
$lang["receivings_successfully_deleted"] = "You have successfully deleted";
$lang["receivings_successfully_updated"] = "Receiving successfully updated";
$lang["receivings_supplier"] = "ผู้ผลิต";
$lang["receivings_supplier_email"] = "Email";
$lang["receivings_supplier_address"] = "Address";
$lang["receivings_supplier_location"] = "Location";
$lang["receivings_supplier_email"] = "อีเมล์";
$lang["receivings_supplier_address"] = "ที่อยู่";
$lang["receivings_supplier_location"] = "ที่อยู่";
$lang["receivings_total"] = "รวม";
$lang["receivings_unable_to_add_item"] = "ไม่สามารถเพิ่มสินค้าได้";
$lang["receivings_unsuccessfully_updated"] = "Receiving unsuccessfully updated";

View File

@@ -7,12 +7,12 @@ $lang["sales_cancel_sale"] = "ยกเลิกการขาย";
$lang["sales_cash"] = "เงินสด";
$lang["sales_change_due"] = "เงินทอน";
$lang["sales_check"] = "เช็ค";
$lang["sales_check_balance"] = "Check remainder";
$lang["sales_check_balance"] = "เช็คยอดคงเหลือ";
$lang["sales_comment"] = "หมายเหตุ";
$lang["sales_comments"] = "หมายเหตุ";
$lang["sales_complete_sale"] = "จบการขาย";
$lang["sales_confirm_cancel_sale"] = "แน่ใจหรือไม่ที่จะล้างรายการขาย? สินค้าทุกอย่างจะถูกลบจากบอร์ด.";
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
$lang["sales_confirm_delete"] = "โปรดยืนยันการลบรายการขายที่เลือกไว้";
$lang["sales_credit"] = "เครดิตการ์ด";
$lang["sales_customer"] = "ลูกค้า";
$lang["sales_customer_email"] = "Customer Email";

View File

@@ -24,28 +24,28 @@ class Barcode_lib
public function get_barcode_config()
{
$data['company'] = $this->CI->Appconfig->get('company');
$data['barcode_content'] = $this->CI->Appconfig->get('barcode_content');
$data['barcode_type'] = $this->CI->Appconfig->get('barcode_type');
$data['barcode_font'] = $this->CI->Appconfig->get('barcode_font');
$data['barcode_font_size'] = $this->CI->Appconfig->get('barcode_font_size');
$data['barcode_height'] = $this->CI->Appconfig->get('barcode_height');
$data['barcode_width'] = $this->CI->Appconfig->get('barcode_width');
$data['barcode_quality'] = $this->CI->Appconfig->get('barcode_quality');
$data['barcode_first_row'] = $this->CI->Appconfig->get('barcode_first_row');
$data['barcode_second_row'] = $this->CI->Appconfig->get('barcode_second_row');
$data['barcode_third_row'] = $this->CI->Appconfig->get('barcode_third_row');
$data['barcode_num_in_row'] = $this->CI->Appconfig->get('barcode_num_in_row');
$data['barcode_page_width'] = $this->CI->Appconfig->get('barcode_page_width');
$data['barcode_page_cellspacing'] = $this->CI->Appconfig->get('barcode_page_cellspacing');
$data['barcode_generate_if_empty'] = $this->CI->Appconfig->get('barcode_generate_if_empty');
$data['company'] = $this->CI->config->item('company');
$data['barcode_content'] = $this->CI->config->item('barcode_content');
$data['barcode_type'] = $this->CI->config->item('barcode_type');
$data['barcode_font'] = $this->CI->config->item('barcode_font');
$data['barcode_font_size'] = $this->CI->config->item('barcode_font_size');
$data['barcode_height'] = $this->CI->config->item('barcode_height');
$data['barcode_width'] = $this->CI->config->item('barcode_width');
$data['barcode_quality'] = $this->CI->config->item('barcode_quality');
$data['barcode_first_row'] = $this->CI->config->item('barcode_first_row');
$data['barcode_second_row'] = $this->CI->config->item('barcode_second_row');
$data['barcode_third_row'] = $this->CI->config->item('barcode_third_row');
$data['barcode_num_in_row'] = $this->CI->config->item('barcode_num_in_row');
$data['barcode_page_width'] = $this->CI->config->item('barcode_page_width');
$data['barcode_page_cellspacing'] = $this->CI->config->item('barcode_page_cellspacing');
$data['barcode_generate_if_empty'] = $this->CI->config->item('barcode_generate_if_empty');
return $data;
}
public function validate_barcode($barcode)
{
$barcode_type = $this->CI->Appconfig->get('barcode_type');
$barcode_type = $this->CI->config->item('barcode_type');
$barcode_instance = $this->get_barcode_instance($barcode_type);
return $barcode_instance->validate($barcode);
}

View File

@@ -18,7 +18,7 @@ class Email_lib
'mailpath' => $this->CI->config->item('mailpath'),
'smtp_host' => $this->CI->config->item('smtp_host'),
'smtp_user' => $this->CI->config->item('smtp_user'),
'smtp_pass' => $this->CI->config->item('smtp_pass'),
'smtp_pass' => $this->CI->encryption->decrypt($this->CI->config->item('smtp_pass')),
'smtp_port' => $this->CI->config->item('smtp_port'),
'smtp_timeout' => $this->CI->config->item('smtp_timeout'),
'smtp_crypto' => $this->CI->config->item('smtp_crypto')

View File

@@ -263,36 +263,6 @@ class Receiving_lib
$this->set_cart($items);
}
public function is_valid_receipt($receipt_receiving_id)
{
//RECV #
$pieces = explode(' ', $receipt_receiving_id);
if(count($pieces) == 2 && preg_match('/(RECV|KIT)/', $pieces[1]))
{
return $this->CI->Receiving->exists($pieces[1]);
}
else
{
return $this->CI->Receiving->get_receiving_by_reference($receipt_receiving_id)->num_rows() > 0;
}
return FALSE;
}
public function is_valid_item_kit($item_kit_id)
{
//KIT #
$pieces = explode(' ',$item_kit_id);
if(count($pieces) == 2)
{
return $this->CI->Item_kit->exists($pieces[1]);
}
return FALSE;
}
public function return_entire_receiving($receipt_receiving_id)
{
//RECV #

View File

@@ -214,6 +214,26 @@ class Sale_lib
{
$this->CI->session->unset_userdata('sales_customer');
}
public function get_employee()
{
if(!$this->CI->session->userdata('sales_employee'))
{
$this->set_employee(-1);
}
return $this->CI->session->userdata('sales_employee');
}
public function set_employee($employee_id)
{
$this->CI->session->set_userdata('sales_employee', $employee_id);
}
public function remove_employee()
{
$this->CI->session->unset_userdata('sales_employee');
}
public function get_mode()
{
@@ -269,14 +289,19 @@ class Sale_lib
{
$this->CI->session->unset_userdata('sales_giftcard_remainder');
}
public function add_item($item_id, $quantity = 1, $item_location, $discount = 0, $price = NULL, $description = NULL, $serialnumber = NULL, $include_deleted = FALSE)
public function add_item(&$item_id, $quantity = 1, $item_location, $discount = 0, $price = NULL, $description = NULL, $serialnumber = NULL, $include_deleted = FALSE)
{
//make sure item exists
if($this->_validate_item($item_id, $include_deleted) == FALSE)
{
return FALSE;
}
$item_info = $this->CI->Item->get_info_by_id_or_number($item_id);
//make sure item exists
if(empty($item_info))
{
$item_id = -1;
return FALSE;
}
$item_id = $item_info->item_id;
// Serialization and Description
@@ -292,7 +317,7 @@ class Sale_lib
$itemalreadyinsale = FALSE; //We did not find the item yet.
$insertkey = 0; //Key to use for new entry.
$updatekey = 0; //Key to use to update(quantity)
$item_info = $this->CI->Item->get_info($item_id, $item_location);
foreach($items as $item)
{
//We primed the loop so maxkey is 0 the first time.
@@ -353,32 +378,29 @@ class Sale_lib
}
$this->set_cart($items);
return TRUE;
}
public function out_of_stock($item_id, $item_location)
{
//make sure item exists
if($this->_validate_item($item_id) == FALSE)
{
return FALSE;
}
$item_info = $this->CI->Item->get_info($item_id);
$item_quantity = $this->CI->Item_quantity->get_item_quantity($item_id,$item_location)->quantity;
$quantity_added = $this->get_quantity_already_added($item_id,$item_location);
if($item_quantity - $quantity_added < 0)
//make sure item exists
if($item_id != -1)
{
return $this->CI->lang->line('sales_quantity_less_than_zero');
}
elseif($item_quantity - $quantity_added < $item_info->reorder_level)
{
return $this->CI->lang->line('sales_quantity_less_than_reorder_level');
$item_quantity = $this->CI->Item_quantity->get_item_quantity($item_id, $item_location)->quantity;
$quantity_added = $this->get_quantity_already_added($item_id, $item_location);
if($item_quantity - $quantity_added < 0)
{
return $this->CI->lang->line('sales_quantity_less_than_zero');
}
elseif($item_quantity - $quantity_added < $this->CI->Item->get_info_by_id_or_number($item_id)->reorder_level)
{
return $this->CI->lang->line('sales_quantity_less_than_reorder_level');
}
}
return FALSE;
return '';
}
public function get_quantity_already_added($item_id, $item_location)
@@ -437,42 +459,6 @@ class Sale_lib
$this->set_cart($items);
}
public function is_valid_receipt(&$receipt_sale_id)
{
//POS #
$pieces = explode(' ', $receipt_sale_id);
if(count($pieces) == 2 && strtolower($pieces[0]) == 'pos')
{
return $this->CI->Sale->exists($pieces[1]);
}
elseif($this->CI->config->item('invoice_enable') == TRUE)
{
$sale_info = $this->CI->Sale->get_sale_by_invoice_number($receipt_sale_id);
if($sale_info->num_rows() > 0)
{
$receipt_sale_id = 'POS ' . $sale_info->row()->sale_id;
return TRUE;
}
}
return FALSE;
}
public function is_valid_item_kit($item_kit_id)
{
//KIT #
$pieces = explode(' ', $item_kit_id);
if(count($pieces) == 2)
{
return $this->CI->Item_kit->exists($pieces[1]);
}
return FALSE;
}
public function return_entire_sale($receipt_sale_id)
{
//POS #
@@ -521,6 +507,7 @@ class Sale_lib
}
$this->set_customer($this->CI->Sale->get_customer($sale_id)->person_id);
$this->set_employee($this->CI->Sale->get_employee($sale_id)->person_id);
}
public function copy_entire_suspended_sale($sale_id)
@@ -718,22 +705,6 @@ class Sale_lib
return $total;
}
private function _validate_item(&$item_id, $include_deleted = FALSE)
{
//make sure item exists
if(!$this->CI->Item->exists($item_id, $include_deleted))
{
//try to get item id given an item_number
$item_id = $this->CI->Item->get_item_id($item_id, $include_deleted);
if(!$item_id)
{
return FALSE;
}
}
return TRUE;
}
}
?>

View File

@@ -16,7 +16,7 @@ class Sms_lib
public function sendSMS($phone, $message)
{
$username = $this->CI->config->item('msg_uid');
$password = $this->CI->config->item('msg_pwd');
$password = $this->CI->encryption->decrypt($this->CI->config->item('msg_pwd'));
$originator = $this->CI->config->item('msg_src');
$response = FALSE;
@@ -27,7 +27,7 @@ class Sms_lib
//echo $username . ' ' . $password . ' ' . $phone . ' ' . $message . ' ' . $originator;
}
else
{
{
$response = TRUE;
// make sure passed string is url encoded

View File

@@ -8,9 +8,16 @@ class Tracking_lib
public function __construct()
{
$this->CI =& get_instance();
$clientId = $this->CI->Appconfig->get('client_id');
// some old beta-3.0.0 time client IDs are wrong so clean them up
// this statement should be removed eventually
if(!empty($clientId) && strlen($clientId) < 30)
{
$clientId = NULL;
}
/**
* Setup the class
* optional
@@ -19,7 +26,7 @@ class Tracking_lib
'client_create_random_id' => TRUE, // create a random client id when the class can't fetch the current cliend id or none is provided by "client_id"
'client_fallback_id' => 555, // fallback client id when cid was not found and random client id is off
'client_id' => $clientId, // override client id
'user_id' => $_SERVER['SERVER_ADDR'], // determine current user id
'user_id' => NULL, // determine current user id
// adapter options
'adapter' => array(
'async' => TRUE, // requests to google are async - don't wait for google server response
@@ -28,7 +35,7 @@ class Tracking_lib
);
$this->tracking = new \Racecore\GATracking\GATracking('UA-82359828-2', $options);
if(empty($clientId))
{
$clientId = $this->tracking->getClientId();
@@ -72,10 +79,9 @@ class Tracking_lib
'an' => 'OSPOS',
'av' => $this->CI->config->item('application_version') . ' - ' . substr($this->CI->config->item('commit_sha1'), 5, 12),
'ul' => current_language_code(),
'dh' => $_SERVER['SERVER_ADDR'],
'dp' => $path,
'dt' => $title,
'cd' => $description
'cd' => $description
));
return $this->tracking->sendTracking($event);

View File

@@ -298,7 +298,6 @@ class Employee extends Person
*/
public function login($username, $password)
{
$query = $this->db->get_where('employees', array('username' => $username, 'deleted' => 0), 1);
if($query->num_rows() == 1)
@@ -332,6 +331,7 @@ class Employee extends Person
public function logout()
{
$this->session->sess_destroy();
redirect('login');
}

View File

@@ -6,14 +6,19 @@ class Item extends CI_Model
*/
public function exists($item_id, $ignore_deleted = FALSE, $deleted = FALSE)
{
$this->db->from('items');
$this->db->where('CAST(item_id AS CHAR) = ', $item_id);
if($ignore_deleted == FALSE)
if (ctype_digit($item_id))
{
$this->db->where('deleted', $deleted);
$this->db->from('items');
$this->db->where('item_id', (int) $item_id);
if ($ignore_deleted == FALSE)
{
$this->db->where('deleted', $deleted);
}
return ($this->db->get()->num_rows() == 1);
}
return ($this->db->get()->num_rows() == 1);
return FALSE;
}
/*
@@ -22,10 +27,10 @@ class Item extends CI_Model
public function item_number_exists($item_number, $item_id = '')
{
$this->db->from('items');
$this->db->where('item_number', $item_number);
if(!empty($item_id))
$this->db->where('item_number', (string) $item_number);
if(ctype_digit($item_id))
{
$this->db->where('item_id !=', $item_id);
$this->db->where('item_id !=', (int) $item_id);
}
return ($this->db->get()->num_rows() == 1);
@@ -139,7 +144,7 @@ class Item extends CI_Model
if($stock_location_id > -1)
{
$this->db->join('item_quantities', 'item_quantities.item_id=items.item_id');
$this->db->join('item_quantities', 'item_quantities.item_id = items.item_id');
$this->db->where('location_id', $stock_location_id);
}
@@ -187,6 +192,37 @@ class Item extends CI_Model
return $item_obj;
}
}
/*
Gets information about a particular item by item id or number
*/
public function get_info_by_id_or_number($item_id)
{
$this->db->from('items');
if (ctype_digit($item_id))
{
$this->db->group_start();
$this->db->where('item_id', (int) $item_id);
$this->db->or_where('items.item_number', $item_id);
$this->db->group_end();
}
else
{
$this->db->where('item_number', $item_id);
}
$this->db->where('items.deleted', 0);
$query = $this->db->get();
if($query->num_rows() == 1)
{
return $query->row();
}
return '';
}
/*
Get an item id given an item number
@@ -478,7 +514,7 @@ class Item extends CI_Model
* $old_price (optional) : the current-cost-price
*
* used in receiving-process to update cost-price if changed
* caution: must be used there before item_quantities gets updated, otherwise average price is wrong!
* caution: must be used before item_quantities gets updated, otherwise the average price is wrong!
*
*/
public function change_cost_price($item_id, $items_received, $new_price, $old_price = null)
@@ -491,9 +527,9 @@ class Item extends CI_Model
$this->db->from('item_quantities');
$this->db->select_sum('quantity');
$this->db->where('item_id', $item_id);
$this->db->where('item_id', $item_id);
$this->db->join('stock_locations', 'stock_locations.location_id=item_quantities.location_id');
$this->db->where('stock_locations.deleted', 0);
$this->db->where('stock_locations.deleted', 0);
$old_total_quantity = $this->db->get()->row()->quantity;
$total_quantity = $old_total_quantity + $items_received;
@@ -503,31 +539,5 @@ class Item extends CI_Model
return $this->save($data, $item_id);
}
//We create a temp table that allows us to do easy report queries
public function create_temp_table()
{
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('items_temp') .
'(
SELECT
items.name,
items.item_number,
items.description,
items.reorder_level,
item_quantities.quantity,
stock_locations.location_name,
stock_locations.location_id,
items.cost_price,
items.unit_price,
(items.cost_price * item_quantities.quantity) AS sub_total_value
FROM ' . $this->db->dbprefix('items') . ' AS items
INNER JOIN ' . $this->db->dbprefix('item_quantities') . ' AS item_quantities
ON items.item_id = item_quantities.item_id
INNER JOIN ' . $this->db->dbprefix('stock_locations') . ' AS stock_locations
ON item_quantities.location_id = stock_locations.location_id
WHERE items.deleted = 0 AND stock_locations.deleted = 0
)'
);
}
}
?>

View File

@@ -12,6 +12,25 @@ class Item_kit extends CI_Model
return ($this->db->get()->num_rows() == 1);
}
/*
Check if a given item_id is an item kit
*/
public function is_valid_item_kit($item_kit_id)
{
if(!empty($item_kit_id))
{
//KIT #
$pieces = explode(' ', $item_kit_id);
if(count($pieces) == 2 && preg_match('/(KIT)/', $pieces[0]))
{
return $this->exists($pieces[1]);
}
}
return FALSE;
}
/*
Gets total of rows
*/

View File

@@ -19,6 +19,26 @@ class Receiving extends CI_Model
return $this->db->get();
}
public function is_valid_receipt($receipt_receiving_id)
{
if(!empty($receipt_receiving_id))
{
//RECV #
$pieces = explode(' ', $receipt_receiving_id);
if(count($pieces) == 2 && preg_match('/(RECV|KIT)/', $pieces[0]))
{
return $this->exists($pieces[1]);
}
else
{
return $this->get_receiving_by_reference($receipt_receiving_id)->num_rows() > 0;
}
}
return FALSE;
}
public function exists($receiving_id)
{
$this->db->from('receivings');
@@ -203,10 +223,20 @@ class Receiving extends CI_Model
/*
We create a temp table that allows us to do easy report/receiving queries
*/
public function create_temp_table()
public function create_temp_table(array $inputs)
{
if(empty($inputs['receiving_id']))
{
$where = 'WHERE DATE(receiving_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
}
else
{
$where = 'WHERE receivings_items.receiving_id = ' . $this->db->escape($inputs['receiving_id']);
}
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('receivings_items_temp') .
'(
' (INDEX(receiving_date), INDEX(receiving_id))
(
SELECT
DATE(receiving_time) AS receiving_date,
receiving_time,
@@ -235,6 +265,9 @@ class Receiving extends CI_Model
ON receivings_items.receiving_id = receivings.receiving_id
INNER JOIN ' . $this->db->dbprefix('items') . ' AS items
ON receivings_items.item_id = items.item_id
' . "
$where
" . '
GROUP BY receivings_items.receiving_id, items.item_id, receivings_items.line
)'
);

View File

@@ -3,14 +3,84 @@ class Sale extends CI_Model
{
public function get_info($sale_id)
{
$this->db->select('customer_id, customer_name, customer_first_name AS first_name, customer_last_name AS last_name, customer_email AS email, customer_comments AS comments,
sale_payment_amount AS amount_tendered, SUM(total) AS amount_due, (sale_payment_amount - SUM(total)) AS change_due, payment_type,
sale_id, sale_date, sale_time, comment, invoice_number, employee_id');
$this->db->from('sales_items_temp');
// NOTE: temporary tables are created to speed up searches due to the fact that are ortogonal to the main query
// create a temporary table to contain all the payments per sale item
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_payments_temp') .
'(
SELECT payments.sale_id AS sale_id,
IFNULL(SUM(payments.payment_amount), 0) AS sale_payment_amount,
GROUP_CONCAT(CONCAT(payments.payment_type, " ", payments.payment_amount) SEPARATOR ", ") AS payment_type
FROM ' . $this->db->dbprefix('sales_payments') . ' AS payments
INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales
ON sales.sale_id = payments.sale_id
WHERE sales.sale_id = ' . $this->db->escape($sale_id) . '
GROUP BY sale_id
)'
);
$this->db->where('sale_id', $sale_id);
$this->db->group_by('sale_id');
$this->db->order_by('sale_time', 'asc');
// create a temporary table to contain all the sum of taxes per sale item
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_taxes_temp') .
'(
SELECT sales_items_taxes.sale_id AS sale_id,
sales_items_taxes.item_id AS item_id,
SUM(sales_items_taxes.percent) AS percent
FROM ' . $this->db->dbprefix('sales_items_taxes') . ' AS sales_items_taxes
INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales
ON sales.sale_id = sales_items_taxes.sale_id
INNER JOIN ' . $this->db->dbprefix('sales_items') . ' AS sales_items
ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.line = sales_items_taxes.line
WHERE sales.sale_id = ' . $this->db->escape($sale_id) . '
GROUP BY sales_items_taxes.sale_id, sales_items_taxes.item_id
)'
);
if($this->config->item('tax_included'))
{
$sale_total = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_subtotal = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (100 / (100 + sales_items_taxes.percent)))';
$sale_tax = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 - 100 / (100 + sales_items_taxes.percent)))';
}
else
{
$sale_total = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 + (sales_items_taxes.percent / 100)))';
$sale_subtotal = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_tax = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (sales_items_taxes.percent / 100))';
}
$decimals = totals_decimals();
$this->db->select('
sales.sale_id AS sale_id,
DATE(sales.sale_time) AS sale_date,
sales.sale_time AS sale_time,
sales.comment AS comment,
sales.invoice_number AS invoice_number,
sales.employee_id AS employee_id,
sales.customer_id AS customer_id,
CONCAT(customer_p.first_name, " ", customer_p.last_name) AS customer_name,
customer_p.first_name AS first_name,
customer_p.last_name AS last_name,
customer_p.email AS email,
customer_p.comments AS comments,
' . "
IFNULL(ROUND($sale_total, $decimals), ROUND($sale_subtotal, $decimals)) AS amount_due,
payments.sale_payment_amount AS amount_tendered,
(payments.sale_payment_amount - IFNULL(ROUND($sale_total, $decimals), ROUND($sale_subtotal, $decimals))) AS change_due,
" . '
payments.payment_type AS payment_type
');
$this->db->from('sales_items AS sales_items');
$this->db->join('sales AS sales', 'sales_items.sale_id = sales.sale_id', 'inner');
$this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id', 'left');
$this->db->join('customers AS customer', 'sales.customer_id = customer.person_id', 'left');
$this->db->join('sales_payments_temp AS payments', 'sales.sale_id = payments.sale_id', 'left outer');
$this->db->join('sales_items_taxes_temp AS sales_items_taxes', 'sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.item_id = sales_items_taxes.item_id', 'left outer');
$this->db->where('sales.sale_id', $sale_id);
$this->db->group_by('sales.sale_id');
$this->db->order_by('sales.sale_time', 'asc');
return $this->db->get();
}
@@ -28,61 +98,136 @@ class Sale extends CI_Model
*/
public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc')
{
$this->db->select('sale_id, sale_date, sale_time, SUM(quantity_purchased) AS items_purchased,
customer_name, customer_company_name AS company_name,
SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit,
sale_payment_amount AS amount_tendered, SUM(total) AS amount_due, (sale_payment_amount - SUM(total)) AS change_due,
payment_type, invoice_number');
$this->db->from('sales_items_temp');
// NOTE: temporary tables are created to speed up searches due to the fact that are ortogonal to the main query
// create a temporary table to contain all the payments per sale item
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_payments_temp') .
' (PRIMARY KEY(sale_id), INDEX(sale_id))
(
SELECT payments.sale_id AS sale_id,
IFNULL(SUM(payments.payment_amount), 0) AS sale_payment_amount,
GROUP_CONCAT(CONCAT(payments.payment_type, " ", payments.payment_amount) SEPARATOR ", ") AS payment_type
FROM ' . $this->db->dbprefix('sales_payments') . ' AS payments
INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales
ON sales.sale_id = payments.sale_id
WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']) . '
GROUP BY sale_id
)'
);
$this->db->where('sale_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
// create a temporary table to contain all the sum of taxes per sale item
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_taxes_temp') .
' (INDEX(sale_id), INDEX(item_id))
(
SELECT sales_items_taxes.sale_id AS sale_id,
sales_items_taxes.item_id AS item_id,
SUM(sales_items_taxes.percent) AS percent
FROM ' . $this->db->dbprefix('sales_items_taxes') . ' AS sales_items_taxes
INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales
ON sales.sale_id = sales_items_taxes.sale_id
INNER JOIN ' . $this->db->dbprefix('sales_items') . ' AS sales_items
ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.line = sales_items_taxes.line
WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']) . '
GROUP BY sales_items_taxes.sale_id, sales_items_taxes.item_id
)'
);
if($this->config->item('tax_included'))
{
$sale_total = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_subtotal = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (100 / (100 + sales_items_taxes.percent)))';
$sale_tax = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 - 100 / (100 + sales_items_taxes.percent)))';
}
else
{
$sale_total = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 + (sales_items_taxes.percent / 100)))';
$sale_subtotal = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_tax = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (sales_items_taxes.percent / 100))';
}
$sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)';
$decimals = totals_decimals();
$this->db->select('
sales.sale_id AS sale_id,
DATE(sales.sale_time) AS sale_date,
sales.sale_time AS sale_time,
sales.invoice_number AS invoice_number,
SUM(sales_items.quantity_purchased) AS items_purchased,
CONCAT(customer_p.first_name, " ", customer_p.last_name) AS customer_name,
customer.company_name AS company_name,
' . "
ROUND($sale_subtotal, $decimals) AS subtotal,
IFNULL(ROUND($sale_tax, $decimals), 0) AS tax,
IFNULL(ROUND($sale_total, $decimals), ROUND($sale_subtotal, $decimals)) AS total,
ROUND($sale_cost, $decimals) AS cost,
ROUND($sale_total - IFNULL($sale_tax, 0) - $sale_cost, $decimals) AS profit,
IFNULL(ROUND($sale_total, $decimals), ROUND($sale_subtotal, $decimals)) AS amount_due,
payments.sale_payment_amount AS amount_tendered,
(payments.sale_payment_amount - IFNULL(ROUND($sale_total, $decimals), ROUND($sale_subtotal, $decimals))) AS change_due,
" . '
payments.payment_type AS payment_type
');
$this->db->from('sales_items AS sales_items');
$this->db->join('sales AS sales', 'sales_items.sale_id = sales.sale_id', 'inner');
$this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id', 'left');
$this->db->join('customers AS customer', 'sales.customer_id = customer.person_id', 'left');
$this->db->join('sales_payments_temp AS payments', 'sales.sale_id = payments.sale_id', 'left outer');
$this->db->join('sales_items_taxes_temp AS sales_items_taxes', 'sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.item_id = sales_items_taxes.item_id', 'left outer');
$this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
if(!empty($search))
{
if($filters['is_valid_receipt'] != FALSE)
{
$pieces = explode(' ', $search);
$this->db->where('sale_id', $pieces[1]);
$this->db->where('sales.sale_id', $pieces[1]);
}
else
{
{
$this->db->group_start();
$this->db->like('customer_last_name', $search);
$this->db->or_like('customer_first_name', $search);
$this->db->or_like('customer_name', $search);
$this->db->or_like('customer_company_name', $search);
// customer last name
$this->db->like('customer_p.last_name', $search);
// customer first name
$this->db->or_like('customer_p.first_name', $search);
// customer first and last name
$this->db->or_like('CONCAT(customer_p.first_name, " ", customer_p.last_name)', $search);
// customer company name
$this->db->or_like('customer.company_name', $search);
$this->db->group_end();
}
}
if($filters['location_id'] != 'all')
{
$this->db->where('item_location', $filters['location_id']);
$this->db->where('sales_items.item_location', $filters['location_id']);
}
if($filters['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
$this->db->where('sales_items.quantity_purchased > 0');
}
elseif($filters['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
$this->db->where('sales_items.quantity_purchased < 0');
}
if($filters['only_invoices'] != FALSE)
{
$this->db->where('invoice_number IS NOT NULL');
$this->db->where('sales.invoice_number IS NOT NULL');
}
if($filters['only_cash'] != FALSE)
{
$this->db->group_start();
$this->db->like('payment_type', $this->lang->line('sales_cash'), 'after');
$this->db->or_where('payment_type IS NULL');
$this->db->like('payments.payment_type', $this->lang->line('sales_cash'), 'after');
$this->db->or_where('payments.payment_type IS NULL');
$this->db->group_end();
}
$this->db->group_by('sale_id');
$this->db->group_by('sales.sale_id');
$this->db->order_by($sort, $order);
if($rows > 0)
@@ -102,7 +247,8 @@ class Sale extends CI_Model
$this->db->select('payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount');
$this->db->from('sales');
$this->db->join('sales_payments', 'sales_payments.sale_id = sales.sale_id');
$this->db->join('people', 'people.person_id = sales.customer_id', 'left');
$this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id', 'left');
$this->db->join('customers AS customer', 'sales.customer_id = customer.person_id', 'left');
$this->db->where('DATE(sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
@@ -116,9 +262,14 @@ class Sale extends CI_Model
else
{
$this->db->group_start();
$this->db->like('last_name', $search);
$this->db->or_like('first_name', $search);
$this->db->or_like('CONCAT(first_name, " ", last_name)', $search);
// customer last name
$this->db->like('customer_p.last_name', $search);
// customer first name
$this->db->or_like('customer_p.first_name', $search);
// customer first and last name
$this->db->or_like('CONCAT(customer_p.first_name, " ", customer_p.last_name)', $search);
// customer company name
$this->db->or_like('customer.company_name', $search);
$this->db->group_end();
}
}
@@ -161,7 +312,7 @@ class Sale extends CI_Model
}
}
if( $gift_card_count > 0 )
if($gift_card_count > 0)
{
$payments[] = array('payment_type' => $this->lang->line('sales_giftcard'), 'count' => $gift_card_count, 'payment_amount' => $gift_card_amount);
}
@@ -183,7 +334,7 @@ class Sale extends CI_Model
{
$suggestions = array();
if(!$this->sale_lib->is_valid_receipt($search))
if(!$this->is_valid_receipt($search))
{
$this->db->distinct();
$this->db->select('first_name, last_name');
@@ -238,6 +389,32 @@ class Sale extends CI_Model
return ($start_from + $result['invoice_number_year']);
}
public function is_valid_receipt(&$receipt_sale_id)
{
if(!empty($receipt_sale_id))
{
//POS #
$pieces = explode(' ', $receipt_sale_id);
if(count($pieces) == 2 && preg_match('/(POS)/', $pieces[0]))
{
return $this->exists($pieces[1]);
}
elseif($this->config->item('invoice_enable') == TRUE)
{
$sale_info = $this->get_sale_by_invoice_number($receipt_sale_id);
if($sale_info->num_rows() > 0)
{
$receipt_sale_id = 'POS ' . $sale_info->row()->sale_id;
return TRUE;
}
}
}
return FALSE;
}
public function exists($sale_id)
{
@@ -503,7 +680,15 @@ class Sale extends CI_Model
return $this->Customer->get_info($this->db->get()->row()->customer_id);
}
public function invoice_number_exists($invoice_number, $sale_id = '')
public function get_employee($sale_id)
{
$this->db->from('sales');
$this->db->where('sale_id', $sale_id);
return $this->Employee->get_info($this->db->get()->row()->employee_id);
}
public function check_invoice_number_exists($invoice_number, $sale_id = '')
{
$this->db->from('sales');
$this->db->where('invoice_number', $invoice_number);
@@ -529,28 +714,54 @@ class Sale extends CI_Model
}
//We create a temp table that allows us to do easy report/sales queries
public function create_temp_table()
public function create_temp_table(array $inputs)
{
if($this->config->item('tax_included'))
{
$total = '1';
$subtotal = '(1 - (SUM(1 - 100 / (100 + sales_items_taxes.percent))))';
$tax = '(SUM(1 - 100 / (100 + sales_items_taxes.percent)))';
$sale_total = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_subtotal = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (100 / (100 + SUM(sales_items_taxes.percent))))';
$sale_tax = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 - 100 / (100 + SUM(sales_items_taxes.percent))))';
}
else
{
$tax = '(SUM(sales_items_taxes.percent) / 100)';
$total = '(1 + (SUM(sales_items_taxes.percent / 100)))';
$subtotal = '1';
$sale_total = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 + (SUM(sales_items_taxes.percent) / 100)))';
$sale_subtotal = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_tax = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (SUM(sales_items_taxes.percent) / 100))';
}
$sale_total = '(sales_items.item_unit_price * sales_items.quantity_purchased - sales_items.item_unit_price * sales_items.quantity_purchased * sales_items.discount_percent / 100)';
$sale_cost = '(sales_items.item_cost_price * sales_items.quantity_purchased)';
$decimals = totals_decimals();
if(empty($inputs['sale_id']))
{
$where = 'WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
}
else
{
$where = 'WHERE sales.sale_id = ' . $this->db->escape($inputs['sale_id']);
}
// create a temporary table to contain all the payment types and amount
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_payments_temp') .
' (PRIMARY KEY(sale_id), INDEX(sale_id))
(
SELECT payments.sale_id AS sale_id,
IFNULL(SUM(payments.payment_amount), 0) AS sale_payment_amount,
GROUP_CONCAT(CONCAT(payments.payment_type, " ", payments.payment_amount) SEPARATOR ", ") AS payment_type
FROM ' . $this->db->dbprefix('sales_payments') . ' AS payments
INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales
ON sales.sale_id = payments.sale_id
' . "
$where
" . '
GROUP BY payments.sale_id
)'
);
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_temp') .
'(
' (INDEX(sale_date), INDEX(sale_id))
(
SELECT
DATE(sales.sale_time) AS sale_date,
sales.sale_time,
@@ -579,27 +790,21 @@ class Sale extends CI_Model
sales_items.item_location,
sales_items.description,
payments.payment_type,
IFNULL(payments.sale_payment_amount, 0) AS sale_payment_amount,
SUM(sales_items_taxes.percent) AS item_tax_percent,
payments.sale_payment_amount,
IFNULL(SUM(sales_items_taxes.percent), 0) AS item_tax_percent,
' . "
ROUND($sale_total * $total, $decimals) AS total,
ROUND($sale_total * $tax, $decimals) AS tax,
ROUND($sale_total * $subtotal, $decimals) AS subtotal,
ROUND($sale_total - $sale_cost, $decimals) AS profit,
ROUND($sale_cost, $decimals) AS cost
ROUND($sale_subtotal, $decimals) AS subtotal,
IFNULL(ROUND($sale_tax, $decimals), 0) AS tax,
IFNULL(ROUND($sale_total, $decimals), ROUND($sale_subtotal, $decimals)) AS total,
ROUND($sale_cost, $decimals) AS cost,
ROUND($sale_total - IFNULL($sale_tax, 0) - $sale_cost, $decimals) AS profit
" . '
FROM ' . $this->db->dbprefix('sales_items') . ' AS sales_items
INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales
ON sales_items.sale_id = sales.sale_id
INNER JOIN ' . $this->db->dbprefix('items') . ' AS items
ON sales_items.item_id = items.item_id
LEFT OUTER JOIN (
SELECT sale_id,
SUM(payment_amount) AS sale_payment_amount,
GROUP_CONCAT(CONCAT(payment_type, " ", payment_amount) SEPARATOR ", ") AS payment_type
FROM ' . $this->db->dbprefix('sales_payments') . '
GROUP BY sale_id
) AS payments
LEFT OUTER JOIN ' . $this->db->dbprefix('sales_payments_temp') . ' AS payments
ON sales_items.sale_id = payments.sale_id
LEFT OUTER JOIN ' . $this->db->dbprefix('suppliers') . ' AS supplier
ON items.supplier_id = supplier.person_id
@@ -611,20 +816,15 @@ class Sale extends CI_Model
ON sales.employee_id = employee.person_id
LEFT OUTER JOIN ' . $this->db->dbprefix('sales_items_taxes') . ' AS sales_items_taxes
ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.item_id = sales_items_taxes.item_id AND sales_items.line = sales_items_taxes.line
' . "
$where
" . '
GROUP BY sales.sale_id, items.item_id, sales_items.line
)'
);
//Update null item_tax_percents to be 0 instead of null
$this->db->where('item_tax_percent IS NULL');
$this->db->update('sales_items_temp', array('item_tax_percent' => 0));
//Update null tax to be 0 instead of null
$this->db->where('tax IS NULL');
$this->db->update('sales_items_temp', array('tax' => 0));
//Update null subtotals to be equal to the total as these don't have tax
$this->db->query('UPDATE ' . $this->db->dbprefix('sales_items_temp') . ' SET total = subtotal WHERE total IS NULL');
// drop the temporary table to contain memory consumption as it's no longer required
$this->db->query('DROP TEMPORARY TABLE IF EXISTS ' . $this->db->dbprefix('sales_payments_temp'));
}
}
?>

View File

@@ -161,18 +161,6 @@ class Sale_suspended extends CI_Model
return $this->db->get();
}
public function invoice_number_exists($invoice_number, $sale_id = '')
{
$this->db->from('sales_suspended');
$this->db->where('invoice_number', $invoice_number);
if(!empty($sale_id))
{
$this->db->where('sale_id !=', $sale_id);
}
return ($this->db->get()->num_rows() == 1);
}
public function get_comment($sale_id)
{

View File

@@ -1,26 +1,33 @@
<?php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Report.php");
class Detailed_receivings extends Report
{
function __construct()
{
parent::__construct();
}
public function create(array $inputs)
{
//Create our temp tables to work with the data in our report
$this->Receiving->create_temp_table($inputs);
}
public function getDataColumns()
{
$columns = array(
'summary' => array(
'id' => $this->lang->line('reports_receiving_id'),
'receiving_date' => $this->lang->line('reports_date'),
'quantity' => $this->lang->line('reports_quantity'),
'employee' => $this->lang->line('reports_received_by'),
'supplier' => $this->lang->line('reports_supplied_by'),
'total' => $this->lang->line('reports_total'),
'payment_type' => $this->lang->line('reports_payment_type'),
'reference' => $this->lang->line('receivings_reference'),
'comment' => $this->lang->line('reports_comments'),
'edit' => ''),
array('id' => $this->lang->line('reports_receiving_id')),
array('receiving_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('employee_name' => $this->lang->line('reports_received_by')),
array('supplier' => $this->lang->line('reports_supplied_by')),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('payment_type' => $this->lang->line('reports_payment_type')),
array('reference' => $this->lang->line('receivings_reference')),
array('comment' => $this->lang->line('reports_comments'))),
'details' => array(
$this->lang->line('reports_item_number'),
$this->lang->line('reports_name'),
@@ -50,21 +57,20 @@ class Detailed_receivings extends Report
$this->db->from('receivings_items_temp');
$this->db->join('people AS employee', 'receivings_items_temp.employee_id = employee.person_id');
$this->db->join('suppliers AS supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left');
$this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
if($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['receiving_type'] == 'receiving')
if($inputs['receiving_type'] == 'receiving')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['receiving_type'] == 'returns')
elseif($inputs['receiving_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
elseif ($inputs['receiving_type'] == 'requisitions')
elseif($inputs['receiving_type'] == 'requisitions')
{
$this->db->having('items_purchased = 0');
}
@@ -77,8 +83,7 @@ class Detailed_receivings extends Report
foreach($data['summary'] as $key=>$value)
{
$this->db->select('name, item_number, category, quantity_purchased, serialnumber,total, discount_percent, item_location');
$this->db->select($this->db->dbprefix('receivings_items_temp').".receiving_quantity");
$this->db->select('name, item_number, category, quantity_purchased, serialnumber,total, discount_percent, item_location, receivings_items_temp.receiving_quantity');
$this->db->from('receivings_items_temp');
$this->db->join('items', 'receivings_items_temp.item_id = items.item_id');
$this->db->where('receiving_id = '.$value['receiving_id']);
@@ -92,21 +97,20 @@ class Detailed_receivings extends Report
{
$this->db->select('SUM(total) AS total');
$this->db->from('receivings_items_temp');
$this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
if($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['receiving_type'] == 'receiving')
if($inputs['receiving_type'] == 'receiving')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['receiving_type'] == 'returns')
elseif($inputs['receiving_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
elseif ($inputs['receiving_type'] == 'requisitions')
elseif($inputs['receiving_type'] == 'requisitions')
{
$this->db->where('quantity_purchased = 0');
}

View File

@@ -1,69 +1,75 @@
<?php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Report.php");
class Detailed_sales extends Report
{
function __construct()
{
parent::__construct();
}
public function create(array $inputs)
{
//Create our temp tables to work with the data in our report
$this->Sale->create_temp_table($inputs);
}
public function getDataColumns()
{
return array(
'summary' => array(
'id' => $this->lang->line('reports_sale_id'),
'sale_date' => $this->lang->line('reports_date'),
'quantity' => $this->lang->line('reports_quantity'),
'employee' => $this->lang->line('reports_sold_by'),
'customer' => $this->lang->line('reports_sold_to'),
'subtotal' => $this->lang->line('reports_subtotal'),
'total' => $this->lang->line('reports_total'),
'tax' => $this->lang->line('reports_tax'),
'cost' => $this->lang->line('reports_cost'),
'profit' => $this->lang->line('reports_profit'),
'payment_type' => $this->lang->line('sales_amount_tendered'),
'comment' => $this->lang->line('reports_comments'),
'edit' => ''),
'details' => array(
$this->lang->line('reports_name'),
$this->lang->line('reports_category'),
$this->lang->line('reports_serial_number'),
$this->lang->line('reports_description'),
$this->lang->line('reports_quantity'),
$this->lang->line('reports_subtotal'),
$this->lang->line('reports_total'),
$this->lang->line('reports_tax'),
$this->lang->line('reports_cost'),
$this->lang->line('reports_profit'),
$this->lang->line('reports_discount'))
array('id' => $this->lang->line('reports_sale_id')),
array('sale_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('employee_name' => $this->lang->line('reports_sold_by')),
array('customer_name' => $this->lang->line('reports_sold_to')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'),
array('payment_type' => $this->lang->line('sales_amount_tendered')),
array('comment' => $this->lang->line('reports_comments'))),
'details' => array(
$this->lang->line('reports_name'),
$this->lang->line('reports_category'),
$this->lang->line('reports_serial_number'),
$this->lang->line('reports_description'),
$this->lang->line('reports_quantity'),
$this->lang->line('reports_subtotal'),
$this->lang->line('reports_tax'),
$this->lang->line('reports_total'),
$this->lang->line('reports_cost'),
$this->lang->line('reports_profit'),
$this->lang->line('reports_discount'))
);
}
public function getDataBySaleId($sale_id)
{
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, customer_name, SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->from('sales_items_temp');
$this->db->where('sale_id', $sale_id);
return $this->db->get()->row_array();
}
public function getData(array $inputs)
{
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, customer_name, SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
if($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
if($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
elseif($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
@@ -74,34 +80,33 @@ class Detailed_sales extends Report
$data = array();
$data['summary'] = $this->db->get()->result_array();
$data['details'] = array();
foreach($data['summary'] as $key=>$value)
{
$this->db->select('name, category, quantity_purchased, item_location, serialnumber, description, subtotal, total, tax, cost, profit, discount_percent');
$this->db->select('name, category, quantity_purchased, item_location, serialnumber, description, subtotal, tax, total, cost, profit, discount_percent');
$this->db->from('sales_items_temp');
$this->db->where('sale_id', $value['sale_id']);
$data['details'][$key] = $this->db->get()->result_array();
}
return $data;
}
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->select('SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
if($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
if($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
elseif($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}

View File

@@ -1,27 +1,34 @@
<?php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Report.php");
class Inventory_low extends Report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
{
return array($this->lang->line('reports_item_name'),
$this->lang->line('reports_item_number'),
$this->lang->line('reports_quantity'),
$this->lang->line('reports_reorder_level'),
$this->lang->line('reports_stock_location'));
return array(
array('item_name' => $this->lang->line('reports_item_name')),
array('item_number' => $this->lang->line('reports_item_number')),
array('quantity' => $this->lang->line('reports_quantity')),
array('reorder_level' => $this->lang->line('reports_reorder_level')),
array('location_name' => $this->lang->line('reports_stock_location')));
}
public function getData(array $inputs)
{
$this->db->select('name, item_number, quantity, reorder_level, location_name');
$this->db->from('items_temp');
$this->db->where('quantity <= reorder_level');
$this->db->order_by('name');
$this->db->select('items.name, items.item_number, item_quantities.quantity, items.reorder_level, stock_locations.location_name');
$this->db->from('items');
$this->db->join('item_quantities', 'items.item_id = item_quantities.item_id');
$this->db->join('stock_locations', 'item_quantities.location_id = stock_locations.location_id');
$this->db->where('items.deleted', 0);
$this->db->where('stock_locations.deleted', 0);
$this->db->where('item_quantities.quantity <= items.reorder_level');
$this->db->order_by('items.name');
return $this->db->get()->result_array();
}

View File

@@ -1,5 +1,7 @@
<?php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Report.php");
class Inventory_summary extends Report
{
function __construct()
@@ -9,37 +11,41 @@ class Inventory_summary extends Report
public function getDataColumns()
{
return array($this->lang->line('reports_item_name'),
$this->lang->line('reports_item_number'),
$this->lang->line('reports_quantity'),
$this->lang->line('reports_reorder_level'),
$this->lang->line('reports_stock_location'),
$this->lang->line('reports_cost_price'),
$this->lang->line('reports_unit_price'),
$this->lang->line('reports_sub_total_value'));
return array(array('item_name' => $this->lang->line('reports_item_name')),
array('item_number' => $this->lang->line('reports_item_number')),
array('quantity' => $this->lang->line('reports_quantity')),
array('reorder_level' => $this->lang->line('reports_reorder_level')),
array('location_name' => $this->lang->line('reports_stock_location')),
array('cost_price' => $this->lang->line('reports_cost_price'), 'sorter' => 'number_sorter'),
array('unit_price' => $this->lang->line('reports_unit_price'), 'sorter' => 'number_sorter'),
array('subtotal' => $this->lang->line('reports_sub_total_value'), 'sorter' => 'number_sorter'));
}
public function getData(array $inputs)
{
$this->db->select('name, item_number, quantity, reorder_level, location_name, cost_price, unit_price, sub_total_value');
$this->db->from('items_temp');
{
$this->db->select('items.name, items.item_number, item_quantities.quantity, items.reorder_level, stock_locations.location_name, items.cost_price, items.unit_price, (items.cost_price * item_quantities.quantity) AS sub_total_value');
$this->db->from('items AS items');
$this->db->join('item_quantities AS item_quantities', 'items.item_id = item_quantities.item_id');
$this->db->join('stock_locations AS stock_locations', 'item_quantities.location_id = stock_locations.location_id');
$this->db->where('items.deleted', 0);
$this->db->where('stock_locations.deleted', 0);
// should be corresponding to values Inventory_summary::getItemCountDropdownArray() returns...
if($inputs['item_count'] == 'zero_and_less')
{
$this->db->where('quantity <= 0');
$this->db->where('item_quantities.quantity <= 0');
}
elseif($inputs['item_count'] == 'more_than_zero')
{
$this->db->where('quantity > 0');
$this->db->where('item_quantities.quantity > 0');
}
if($inputs['location_id'] != 'all')
{
$this->db->where('location_id', $inputs['location_id']);
$this->db->where('stock_locations.location_id', $inputs['location_id']);
}
$this->db->order_by('name');
$this->db->order_by('items.name');
return $this->db->get()->result_array();
}

View File

@@ -1,4 +1,5 @@
<?php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
abstract class Report extends CI_Model
{
function __construct()
@@ -10,20 +11,15 @@ abstract class Report extends CI_Model
$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate');
$this->output->set_header('Cache-Control: post-check=0, pre-check=0', FALSE);
$this->output->set_header('Pragma: no-cache');
//Create our temp tables to work with the data in our report
$this->Sale->create_temp_table();
$this->Receiving->create_temp_table();
$this->Item->create_temp_table();
}
//Returns the column names used for the report
// Returns the column names used for the report
public abstract function getDataColumns();
//Returns all the data to be populated into the report
// Returns all the data to be populated into the report
public abstract function getData(array $inputs);
//Returns key=>value pairing of summary data for the report
// Returns key=>value pairing of summary data for the report
public abstract function getSummaryData(array $inputs);
}
?>

View File

@@ -1,5 +1,7 @@
<?php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Report.php");
class Specific_customer extends Report
{
function __construct()
@@ -7,18 +9,47 @@ class Specific_customer extends Report
parent::__construct();
}
public function create(array $inputs)
{
//Create our temp tables to work with the data in our report
$this->Sale->create_temp_table($inputs);
}
public function getDataColumns()
{
return array('summary' => array($this->lang->line('reports_sale_id'), $this->lang->line('reports_date'), $this->lang->line('reports_quantity'), $this->lang->line('reports_sold_by'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'), $this->lang->line('reports_payment_type'), $this->lang->line('reports_comments')),
'details' => array($this->lang->line('reports_name'), $this->lang->line('reports_category'), $this->lang->line('reports_serial_number'), $this->lang->line('reports_description'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'), $this->lang->line('reports_discount'))
return array(
'summary' => array(
array('id' => $this->lang->line('reports_sale_id')),
array('sale_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('sold_by' => $this->lang->line('reports_sold_by')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'),
array('payment_type' => $this->lang->line('reports_payment_type')),
array('comments' => $this->lang->line('reports_comments'))),
'details' => array(
$this->lang->line('reports_name'),
$this->lang->line('reports_category'),
$this->lang->line('reports_serial_number'),
$this->lang->line('reports_description'),
$this->lang->line('reports_quantity'),
$this->lang->line('reports_subtotal'),
$this->lang->line('reports_tax'),
$this->lang->line('reports_total'),
$this->lang->line('reports_cost'),
$this->lang->line('reports_profit'),
$this->lang->line('reports_discount'))
);
}
public function getData(array $inputs)
{
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND customer_id=" . $this->db->escape($inputs['customer_id']));
$this->db->where('customer_id', $inputs['customer_id']);
if ($inputs['sale_type'] == 'sales')
{
@@ -38,7 +69,7 @@ class Specific_customer extends Report
foreach($data['summary'] as $key=>$value)
{
$this->db->select('name, category, serialnumber, description, quantity_purchased, subtotal, total, tax, cost, profit, discount_percent');
$this->db->select('name, category, serialnumber, description, quantity_purchased, subtotal, tax, total, cost, profit, discount_percent');
$this->db->from('sales_items_temp');
$this->db->where('sale_id', $value['sale_id']);
$data['details'][$key] = $this->db->get()->result_array();
@@ -49,9 +80,9 @@ class Specific_customer extends Report
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->select('SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND customer_id=" . $this->db->escape($inputs['customer_id']));
$this->db->where('customer_id', $inputs['customer_id']);
if ($inputs['sale_type'] == 'sales')
{

View File

@@ -1,5 +1,7 @@
<?php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Report.php");
class Specific_discount extends Report
{
function __construct()
@@ -7,19 +9,46 @@ class Specific_discount extends Report
parent::__construct();
}
public function create(array $inputs)
{
//Create our temp tables to work with the data in our report
$this->Sale->create_temp_table($inputs);
}
public function getDataColumns()
{
return array('summary' => array($this->lang->line('reports_sale_id'), $this->lang->line('reports_date'), $this->lang->line('reports_quantity'), $this->lang->line('reports_sold_to'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), /*$this->lang->line('reports_profit'),*/ $this->lang->line('reports_payment_type'), $this->lang->line('reports_comments')),
'details' => array($this->lang->line('reports_name'), $this->lang->line('reports_category'), $this->lang->line('reports_serial_number'), $this->lang->line('reports_description'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), /*$this->lang->line('reports_profit'),*/ $this->lang->line('reports_discount'))
return array(
'summary' => array(
array('id' => $this->lang->line('reports_sale_id')),
array('sale_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('customer_name' => $this->lang->line('reports_sold_to')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'),
array('payment_type' => $this->lang->line('reports_payment_type')),
array('comments' => $this->lang->line('reports_comments'))),
'details' => array(
$this->lang->line('reports_name'),
$this->lang->line('reports_category'),
$this->lang->line('reports_serial_number'),
$this->lang->line('reports_description'),
$this->lang->line('reports_quantity'),
$this->lang->line('reports_subtotal'),
$this->lang->line('reports_total'),
$this->lang->line('reports_tax'),
$this->lang->line('reports_profit'),
$this->lang->line('reports_discount'))
);
}
public function getData(array $inputs)
{
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND discount_percent >=" . $this->db->escape($inputs['discount']));
$this->db->where('discount_percent >=', $inputs['discount']);
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
@@ -38,10 +67,9 @@ class Specific_discount extends Report
foreach($data['summary'] as $key=>$value)
{
$this->db->select('name, serialnumber, category, description, quantity_purchased, subtotal, total, tax, cost, profit, discount_percent');
$this->db->select('name, serialnumber, category, description, quantity_purchased, subtotal, tax, total, cost, profit, discount_percent');
$this->db->from('sales_items_temp');
$this->db->where('sale_id', $value['sale_id']);
$this->db->where('discount_percent >= ', $inputs['discount']);
$data['details'][$key] = $this->db->get()->result_array();
}
@@ -50,10 +78,10 @@ class Specific_discount extends Report
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->select('SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND discount_percent >=" . $this->db->escape($inputs['discount']));
$this->db->where('discount_percent >=', $inputs['discount']);
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');

View File

@@ -1,5 +1,7 @@
<?php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Report.php");
class Specific_employee extends Report
{
function __construct()
@@ -7,18 +9,47 @@ class Specific_employee extends Report
parent::__construct();
}
public function create(array $inputs)
{
//Create our temp tables to work with the data in our report
$this->Sale->create_temp_table($inputs);
}
public function getDataColumns()
{
return array('summary' => array($this->lang->line('reports_sale_id'), $this->lang->line('reports_date'), $this->lang->line('reports_quantity'), $this->lang->line('reports_sold_to'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'), $this->lang->line('reports_payment_type'), $this->lang->line('reports_comments')),
'details' => array($this->lang->line('reports_name'), $this->lang->line('reports_category'), $this->lang->line('reports_serial_number'), $this->lang->line('reports_description'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'), $this->lang->line('reports_discount'))
return array(
'summary' => array(
array('id' => $this->lang->line('reports_sale_id')),
array('sale_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('customer_name' => $this->lang->line('reports_sold_to')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'),
array('payment_type' => $this->lang->line('reports_payment_type')),
array('comments' => $this->lang->line('reports_comments'))),
'details' => array(
$this->lang->line('reports_name'),
$this->lang->line('reports_category'),
$this->lang->line('reports_serial_number'),
$this->lang->line('reports_description'),
$this->lang->line('reports_quantity'),
$this->lang->line('reports_subtotal'),
$this->lang->line('reports_tax'),
$this->lang->line('reports_total'),
$this->lang->line('reports_cost'),
$this->lang->line('reports_profit'),
$this->lang->line('reports_discount'))
);
}
public function getData(array $inputs)
{
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND employee_id=" . $this->db->escape($inputs['employee_id']));
$this->db->where('employee_id', $inputs['employee_id']);
if ($inputs['sale_type'] == 'sales')
{
@@ -38,7 +69,7 @@ class Specific_employee extends Report
foreach($data['summary'] as $key=>$value)
{
$this->db->select('name, category, serialnumber, description, quantity_purchased, subtotal, total, tax, cost, profit, discount_percent');
$this->db->select('name, category, serialnumber, description, quantity_purchased, subtotal, tax, total, cost, profit, discount_percent');
$this->db->from('sales_items_temp');
$this->db->where('sale_id', $value['sale_id']);
$data['details'][$key] = $this->db->get()->result_array();
@@ -49,9 +80,9 @@ class Specific_employee extends Report
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->select('SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND employee_id=" . $this->db->escape($inputs['employee_id']));
$this->db->where('employee_id', $inputs['employee_id']);
if ($inputs['sale_type'] == 'sales')
{

View File

@@ -1,64 +1,47 @@
<?php
require_once("Report.php");
class Summary_categories extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_categories extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_category'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'));
return array(
array('category' => $this->lang->line('reports_category')),
array('quantity' => $this->lang->line('reports_quantity')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
}
public function getData(array $inputs)
protected function _select(array $inputs)
{
$this->db->select('category, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_select($inputs);
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
$this->db->select('
items.category AS category,
SUM(sales_items.quantity_purchased) AS quantity_purchased
');
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
protected function _from()
{
parent::_from();
$this->db->join('items AS items', 'sales_items.item_id = items.item_id', 'inner');
}
protected function _group_order()
{
$this->db->group_by('category');
$this->db->order_by('category');
return $this->db->get()->result_array();
}
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}
?>

View File

@@ -1,64 +1,47 @@
<?php
require_once("Report.php");
class Summary_customers extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_customers extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_customer'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'));
return array(
array('customer_name' => $this->lang->line('reports_customer')),
array('quantity' => $this->lang->line('reports_quantity')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
}
public function getData(array $inputs)
protected function _select(array $inputs)
{
$this->db->select('customer_name AS customer, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_select($inputs);
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('customer_id');
$this->db->order_by('customer_last_name');
return $this->db->get()->result_array();
$this->db->select('
CONCAT(customer_p.first_name, " ", customer_p.last_name) AS customer,
SUM(sales_items.quantity_purchased) AS quantity_purchased
');
}
public function getSummaryData(array $inputs)
protected function _from()
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_from();
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
$this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id');
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
protected function _group_order()
{
$this->db->group_by('sales.customer_id');
$this->db->order_by('customer_p.last_name');
}
}
?>

View File

@@ -1,65 +1,35 @@
<?php
require_once("Report.php");
class Summary_discounts extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_discounts extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_discount_percent'), $this->lang->line('reports_count'));
return array(
array('discount' => $this->lang->line('reports_discount_percent'), 'sorter' => 'number_sorter'),
array('count' => $this->lang->line('reports_count')));
}
public function getData(array $inputs)
{
$this->db->select('CONCAT(discount_percent, "%") AS discount_percent, count(*) AS count');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
$this->db->select('CONCAT(sales_items.discount_percent, "%") AS discount_percent, count(*) AS count');
$this->db->from('sales_items AS sales_items');
$this->db->join('sales AS sales', 'sales_items.sale_id = sales.sale_id', 'inner');
$this->db->where('discount_percent > 0');
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->_where($inputs);
$this->db->group_by('sales_items_temp.discount_percent');
$this->db->order_by('discount_percent');
$this->db->group_by('sales_items.discount_percent');
$this->db->order_by('sales_items.discount_percent');
return $this->db->get()->result_array();
}
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}
?>

View File

@@ -1,64 +1,47 @@
<?php
require_once("Report.php");
class Summary_employees extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_employees extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_employee'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'));
return array(
array('employee_name' => $this->lang->line('reports_employee')),
array('quantity' => $this->lang->line('reports_quantity')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
}
public function getData(array $inputs)
protected function _select(array $inputs)
{
$this->db->select('employee_name AS employee, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_select($inputs);
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('employee_id');
$this->db->order_by('employee_name');
return $this->db->get()->result_array();
$this->db->select('
CONCAT(employee_p.first_name, " ", employee_p.last_name) AS employee,
SUM(sales_items.quantity_purchased) AS quantity_purchased
');
}
public function getSummaryData(array $inputs)
protected function _from()
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_from();
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
$this->db->join('people AS employee_p', 'sales.employee_id = employee_p.person_id');
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
protected function _group_order()
{
$this->db->group_by('sales.employee_id');
$this->db->order_by('employee_p.last_name');
}
}
?>

View File

@@ -1,64 +1,47 @@
<?php
require_once("Report.php");
class Summary_items extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_items extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_item'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'));
return array(
array('item_name' => $this->lang->line('reports_item')),
array('quantity' => $this->lang->line('reports_quantity')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
}
public function getData(array $inputs)
protected function _select(array $inputs)
{
$this->db->select('name, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_select($inputs);
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('item_id');
$this->db->order_by('name');
return $this->db->get()->result_array();
$this->db->select('
items.name AS name,
SUM(sales_items.quantity_purchased) AS quantity_purchased
');
}
public function getSummaryData(array $inputs)
protected function _from()
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_from();
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
$this->db->join('items AS items', 'sales_items.item_id = items.item_id', 'inner');
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
protected function _group_order()
{
$this->db->group_by('items.item_id');
$this->db->order_by('items.name');
}
}
?>

View File

@@ -1,37 +1,29 @@
<?php
require_once("Report.php");
class Summary_payments extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_payments extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_payment_type'), $this->lang->line('reports_count'), $this->lang->line('sales_amount_tendered'));
return array(
array('payment_type' => $this->lang->line('reports_payment_type')),
array('report_count' => $this->lang->line('reports_count')),
array('amount_tendered' => $this->lang->line('sales_amount_tendered'), 'sorter' => 'number_sorter'));
}
public function getData(array $inputs)
{
$this->db->select('sales_payments.payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount');
$this->db->from('sales_payments');
$this->db->join('sales', 'sales.sale_id=sales_payments.sale_id');
$this->db->where("date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
$this->db->join('sales AS sales', 'sales.sale_id = sales_payments.sale_id');
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('payment_amount > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('payment_amount < 0');
}
$this->_where($inputs);
$this->db->group_by("payment_type");
@@ -52,35 +44,12 @@ class Summary_payments extends Report
}
}
if( $gift_card_count > 0 )
if($gift_card_count > 0)
{
$payments[] = array('payment_type' => $this->lang->line('sales_giftcard'), 'count' => $gift_card_count, 'payment_amount' => $gift_card_amount);
}
return $payments;
}
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}
?>

View File

@@ -0,0 +1,137 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Report.php");
abstract class Summary_report extends Report
{
function __construct()
{
parent::__construct();
}
/*
Private interface
*/
private function _common_select(array $inputs)
{
// create a temporary table to contain all the sum of taxes per sale item
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_taxes_temp') .
' (INDEX(sale_id), INDEX(item_id))
(
SELECT sales_items_taxes.sale_id AS sale_id,
sales_items_taxes.item_id AS item_id,
SUM(sales_items_taxes.percent) AS percent
FROM ' . $this->db->dbprefix('sales_items_taxes') . ' AS sales_items_taxes
INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales
ON sales.sale_id = sales_items_taxes.sale_id
INNER JOIN ' . $this->db->dbprefix('sales_items') . ' AS sales_items
ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.line = sales_items_taxes.line
WHERE DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . '
GROUP BY sales_items_taxes.sale_id, sales_items_taxes.item_id
)'
);
if($this->config->item('tax_included'))
{
$sale_total = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_subtotal = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (100 / (100 + sales_items_taxes.percent)))';
$sale_tax = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 - 100 / (100 + sales_items_taxes.percent)))';
}
else
{
$sale_total = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 + (sales_items_taxes.percent / 100)))';
$sale_subtotal = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_tax = 'SUM(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (sales_items_taxes.percent / 100))';
}
$sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)';
$decimals = totals_decimals();
$this->db->select("
ROUND($sale_subtotal, $decimals) AS subtotal,
IFNULL(ROUND($sale_tax, $decimals), 0) AS tax,
IFNULL(ROUND($sale_total, $decimals), ROUND($sale_subtotal, $decimals)) AS total,
ROUND($sale_cost, $decimals) AS cost,
ROUND($sale_total - IFNULL($sale_tax, 0) - $sale_cost, $decimals) AS profit
");
}
private function _common_from()
{
$this->db->from('sales_items AS sales_items');
$this->db->join('sales AS sales', 'sales_items.sale_id = sales.sale_id', 'inner');
$this->db->join('sales_items_taxes_temp AS sales_items_taxes', 'sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.item_id = sales_items_taxes.item_id', 'left outer');
}
private function _common_where(array $inputs)
{
$this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']));
if($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
}
/*
Protected class interface implemented by derived classes
*/
abstract protected function _get_data_columns();
protected function _select(array $inputs) { $this->_common_select($inputs); }
protected function _from() { $this->_common_from(); }
protected function _where(array $inputs) { $this->_common_where($inputs); }
protected function _group_order() {}
/*
Public interface implementing the base abstract class, in general it should not be extended unless there is a valid reason
*/
public function getDataColumns()
{
return $this->_get_data_columns();
}
public function getData(array $inputs)
{
$this->_select($inputs);
$this->_from();
$this->_where($inputs);
$this->_group_order();
return $this->db->get()->result_array();
}
public function getSummaryData(array $inputs)
{
$this->_common_select($inputs);
$this->_common_from();
$this->_common_where($inputs);
return $this->db->get()->row_array();
}
}
?>

View File

@@ -1,65 +1,40 @@
<?php
require_once("Report.php");
class Summary_sales extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_sales extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_date'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'));
return array(
array('sale_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
}
protected function _select(array $inputs)
{
parent::_select($inputs);
$this->db->select('
DATE(sales.sale_time) AS sale_date,
SUM(sales_items.quantity_purchased) AS quantity_purchased
');
}
public function getData(array $inputs)
{
$this->db->select('sale_date, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
protected function _group_order()
{
$this->db->group_by('sale_date');
$this->db->order_by('sale_date');
return $this->db->get()->result_array();
}
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}
?>

View File

@@ -1,68 +1,49 @@
<?php
require_once("Report.php");
class Summary_suppliers extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_suppliers extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_supplier'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit'));
return array(
array('supplier_name' => $this->lang->line('reports_supplier')),
array('quantity' => $this->lang->line('reports_quantity')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
}
public function getData(array $inputs)
protected function _select(array $inputs)
{
$this->db->select('CONCAT(company_name, " (", first_name, " ", last_name, ")") AS supplier, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id');
$this->db->join('people', 'suppliers.person_id = people.person_id');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_select($inputs);
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('supplier_id');
$this->db->order_by('last_name');
return $this->db->get()->result_array();
$this->db->select('
CONCAT(supplier_c.company_name, " (", supplier_p.first_name, " ", supplier_p.last_name, ")") AS supplier,
SUM(sales_items.quantity_purchased) AS quantity_purchased
');
}
public function getSummaryData(array $inputs)
protected function _from()
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id');
$this->db->join('people', 'suppliers.person_id = people.person_id');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
parent::_from();
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
$this->db->join('items AS items', 'sales_items.item_id = items.item_id', 'inner');
$this->db->join('suppliers AS supplier_c', 'supplier_c.person_id = items.supplier_id');
$this->db->join('people AS supplier_p', 'supplier_c.person_id = supplier_p.person_id');
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
protected function _group_order()
{
$this->db->group_by('items.supplier_id');
$this->db->order_by('supplier_p.last_name');
}
}
?>

View File

@@ -1,87 +1,75 @@
<?php
require_once("Report.php");
class Summary_taxes extends Report
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Summary_report.php");
class Summary_taxes extends Summary_report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
protected function _get_data_columns()
{
return array($this->lang->line('reports_tax_percent'), $this->lang->line('reports_count'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'));
return array(
array('tax_percent' => $this->lang->line('reports_tax_percent'), 'sorter' => 'number_sorter'),
array('report_count' => $this->lang->line('reports_count')),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'));
}
public function getData(array $inputs)
{
$quantity_cond = '';
if ($inputs['sale_type'] == 'sales')
if($inputs['sale_type'] == 'sales')
{
$quantity_cond = 'and quantity_purchased > 0';
$quantity_cond = 'AND quantity_purchased > 0';
}
elseif ($inputs['sale_type'] == 'returns')
elseif($inputs['sale_type'] == 'returns')
{
$quantity_cond = 'and quantity_purchased < 0';
$quantity_cond = 'AND quantity_purchased < 0';
}
if ($inputs['location_id'] != 'all')
if($inputs['location_id'] != 'all')
{
$quantity_cond .= 'and item_location = '. $this->db->escape($inputs['location_id']);
$quantity_cond .= 'AND item_location = '. $this->db->escape($inputs['location_id']);
}
if ($this->config->item('tax_included'))
if($this->config->item('tax_included'))
{
$total = "1";
$subtotal = "(100/(100+percent))";
$tax = "(1 - (100/(100 +percent)))";
$sale_total = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_subtotal = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (100 / (100 + sales_items_taxes.percent)))';
$sale_tax = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 - 100 / (100 + sales_items_taxes.percent)))';
}
else
{
$tax = "(percent/100)";
$total = "(1+(percent/100))";
$subtotal = "1";
$sale_total = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (1 + (sales_items_taxes.percent / 100)))';
$sale_subtotal = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))';
$sale_tax = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100) * (sales_items_taxes.percent / 100))';
}
$decimals = totals_decimals();
$query = $this->db->query("SELECT percent, count(*) AS count, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax
FROM (SELECT name, CONCAT(ROUND(percent, $decimals), '%') AS percent,
ROUND((item_unit_price * quantity_purchased - item_unit_price * quantity_purchased * discount_percent /100) * $subtotal, $decimals) AS subtotal,
ROUND((item_unit_price * quantity_purchased - item_unit_price * quantity_purchased * discount_percent /100) * $total, $decimals) AS total,
ROUND((item_unit_price * quantity_purchased - item_unit_price * quantity_purchased * discount_percent /100) * $tax, $decimals) AS tax
FROM ".$this->db->dbprefix('sales_items_taxes')."
JOIN ".$this->db->dbprefix('sales_items')." ON "
.$this->db->dbprefix('sales_items').'.sale_id='.$this->db->dbprefix('sales_items_taxes').'.sale_id'." AND "
.$this->db->dbprefix('sales_items').'.item_id='.$this->db->dbprefix('sales_items_taxes').'.item_id'." AND "
.$this->db->dbprefix('sales_items').'.line='.$this->db->dbprefix('sales_items_taxes').'.line'
." JOIN ".$this->db->dbprefix('sales')." ON ".$this->db->dbprefix('sales_items_taxes').".sale_id=".$this->db->dbprefix('sales').".sale_id
WHERE date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " $quantity_cond) AS temp_taxes
GROUP BY percent");
$query = $this->db->query("SELECT percent, count(*) AS count, ROUND(SUM(subtotal), $decimals) AS subtotal, ROUND(SUM(tax), $decimals) AS tax, ROUND(SUM(total), $decimals) AS total
FROM (
SELECT
CONCAT(IFNULL(ROUND(percent, $decimals), 0), '%') AS percent,
$sale_subtotal AS subtotal,
IFNULL($sale_tax, 0) AS tax,
IFNULL($sale_total, $sale_subtotal) AS total
FROM " . $this->db->dbprefix('sales_items') . ' AS sales_items
INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales
ON sales_items.sale_id = sales.sale_id
LEFT OUTER JOIN ' . $this->db->dbprefix('sales_items_taxes') . ' AS sales_items_taxes
ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.item_id = sales_items_taxes.item_id AND sales_items.line = sales_items_taxes.line
WHERE DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . " $quantity_cond
) AS temp_taxes
GROUP BY percent"
);
return $query->result_array();
}
public function getSummaryData(array $inputs)
{
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
$this->db->from('sales_items_temp');
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
if ($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
}
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}
?>

View File

@@ -25,7 +25,7 @@
<div class="fileinput-new thumbnail" style="width: 200px; height: 200px;"></div>
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 200px;">
<img data-src="holder.js/100%x100%" alt="<?php echo $this->lang->line('config_company_logo'); ?>"
src="<?php if($logo_exists) echo base_url('uploads/' . $this->Appconfig->get('company_logo')); else echo ''; ?>"
src="<?php if($logo_exists) echo base_url('uploads/' . $this->config->item('company_logo')); else echo ''; ?>"
style="max-height: 100%; max-width: 100%;">
</div>
<div>

View File

@@ -161,7 +161,7 @@
'America/Caracas' => '(GMT-04:30) Caracas',
'America/Santiago' => '(GMT-04:00) Santiago',
'America/La_Paz' => '(GMT-04:00) La Paz',
'Atlantic/Stanley' => '(GMT-04:00) Faukland Islands',
'Atlantic/Stanley' => '(GMT-04:00) Falkland Islands',
'America/Campo_Grande' => '(GMT-04:00) Brazil',
'America/Goose_Bay' => '(GMT-04:00) Atlantic Time (Goose Bay)',
'America/Glace_Bay' => '(GMT-04:00) Atlantic Time (Canada)',
@@ -333,6 +333,7 @@ $(document).ready(function()
number_locale: '<?php echo $this->lang->line('config_number_locale_invalid') ?>'
}
},
errorLabelContainer: "#locale_error_message_box"
}));
});

View File

@@ -59,7 +59,7 @@ $(document).ready(function()
<div id="title_bar" class="btn-toolbar print_hide">
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo $this->lang->line('common_submit') ?>' data-href='<?php echo site_url($controller_name."/excel_import"); ?>'
title='<?php echo $this->lang->line('customers_import_items_excel'); ?>'>
title='<?php echo $this->lang->line('items_import_items_excel'); ?>'>
<span class="glyphicon glyphicon-import">&nbsp</span><?php echo $this->lang->line('common_import_excel'); ?>
</button>

View File

@@ -54,6 +54,7 @@
<script src="bower_components/chartist-plugin-axistitle/dist/chartist-plugin-axistitle.min.js"></script>
<script src="bower_components/chartist-plugin-pointlabels/dist/chartist-plugin-pointlabels.min.js"></script>
<script src="bower_components/chartist-plugin-tooltip/dist/chartist-plugin-tooltip.min.js"></script>
<script src="bower_components/chartist-plugin-barlabels/dist/chartist-plugin-barlabels.min.js"></script>
<script src="bower_components/remarkable-bootstrap-notify/bootstrap-notify.js"></script>
<script src="bower_components/js-cookie/src/js.cookie.js"></script>
<script src="bower_components/blockUI/jquery.blockUI.js"></script>
@@ -73,7 +74,7 @@
<link rel="stylesheet" type="text/css" href="dist/style.css"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=9a77ed1ae9"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=bc5842b19a"></script>
<!-- end minjs template tags -->
<?php endif; ?>

View File

@@ -8,12 +8,12 @@ function printdoc()
if (window.jsPrintSetup)
{
// set top margins in millimeters
jsPrintSetup.setOption('marginTop', '<?php echo $this->Appconfig->get('print_top_margin'); ?>');
jsPrintSetup.setOption('marginLeft', '<?php echo $this->Appconfig->get('print_left_margin'); ?>');
jsPrintSetup.setOption('marginBottom', '<?php echo $this->Appconfig->get('print_bottom_margin'); ?>');
jsPrintSetup.setOption('marginRight', '<?php echo $this->Appconfig->get('print_right_margin'); ?>');
jsPrintSetup.setOption('marginTop', '<?php echo $this->config->item('print_top_margin'); ?>');
jsPrintSetup.setOption('marginLeft', '<?php echo $this->config->item('print_left_margin'); ?>');
jsPrintSetup.setOption('marginBottom', '<?php echo $this->config->item('print_bottom_margin'); ?>');
jsPrintSetup.setOption('marginRight', '<?php echo $this->config->item('print_right_margin'); ?>');
<?php if (!$this->Appconfig->get('print_header'))
<?php if (!$this->config->item('print_header'))
{
?>
// set page header
@@ -22,7 +22,7 @@ function printdoc()
jsPrintSetup.setOption('headerStrRight', '');
<?php
}
if (!$this->Appconfig->get('print_footer'))
if (!$this->config->item('print_footer'))
{
?>
// set empty page footer
@@ -44,7 +44,7 @@ function printdoc()
// clears user preferences always silent print value
// to enable using 'printSilent' option
jsPrintSetup.clearSilentPrint();
<?php if (!$this->Appconfig->get('print_silently'))
<?php if (!$this->config->item('print_silently'))
{
?>
// Suppress print dialog (for this context only)

View File

@@ -18,7 +18,7 @@ if (isset($error_message))
<div id="receipt_wrapper">
<div id="receipt_header">
<?php
if ($this->Appconfig->get('company_logo') == '')
if ($this->config->item('company_logo') == '')
{
?>
<div id="company_name"><?php echo $this->config->item('company'); ?></div>
@@ -27,7 +27,7 @@ if (isset($error_message))
else
{
?>
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->config->item('company_logo')); ?>" alt="company_logo" /></div>
<?php
}
?>

View File

@@ -87,6 +87,8 @@
}
}),
Chartist.plugins.ctBarLabels(),
Chartist.plugins.ctPointLabels({
textAnchor: 'middle'
})

View File

@@ -90,6 +90,8 @@
}
}),
Chartist.plugins.ctBarLabels(),
Chartist.plugins.ctPointLabels({
textAnchor: 'middle'
})

View File

@@ -33,13 +33,23 @@
axisX: {
// Lets offset the chart a bit from the labels
offset: 120,
position: 'end'
position: 'end',
// offset the labels a bit from the axis to avoid overlaps
labelOffset: {
x: 0,
y: 20
}
},
// Y-Axis specific configuration
axisY: {
// Lets offset the chart a bit from the labels
offset: 60,
offset: 80,
// offset the labels a bit from the axis to avoid overlaps
labelOffset: {
x: -20,
y: 0
},
// The label interpolation function enables you to modify the values
// used for the labels on each axis.
labelInterpolationFnc: function(value) {

View File

@@ -25,7 +25,7 @@
<?php $this->load->view('partial/bootstrap_tables_locale'); ?>
$('#table').bootstrapTable({
columns: <?php echo transform_headers_readonly($headers); ?>,
columns: <?php echo transform_headers($headers, TRUE, FALSE); ?>,
pageSize: <?php echo $this->config->item('lines_per_page'); ?>,
striped: true,
sortable: true,

View File

@@ -20,6 +20,7 @@
</div>
<script type="text/javascript">
$(document).ready(function()
{
<?php $this->load->view('partial/bootstrap_tables_locale'); ?>
@@ -28,6 +29,7 @@
var init_dialog = function()
{
<?php if (isset($editable)): ?>
table_support.submit_handler('<?php echo site_url("reports/get_detailed_" . $editable . "_row")?>');
dialog_support.init("a.modal-dlg");
@@ -35,7 +37,7 @@
};
$('#table').bootstrapTable({
columns: <?php echo transform_headers_readonly($headers['summary']); ?>,
columns: <?php echo transform_headers($headers['summary'], TRUE); ?>,
pageSize: <?php echo $this->config->item('lines_per_page'); ?>,
striped: true,
pagination: true,
@@ -56,7 +58,7 @@
onExpandRow: function (index, row, $detail) {
$detail.html('<table></table>').find("table").bootstrapTable({
columns: <?php echo transform_headers_readonly($headers['details']); ?>,
data: detail_data[row.id || $(row[0]).text().replace(/(POS|RECV)\s*/g, '')]
data: detail_data[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(/(POS|RECV)\s*/g, '')]
});
}
});

View File

@@ -19,10 +19,10 @@ if (isset($error_message))
<table id="info">
<tr>
<td id="logo">
<?php if($this->Appconfig->get('company_logo') != '')
<?php if($this->config->item('company_logo') != '')
{
?>
<img id="image" src="<?php echo 'uploads/' . $this->Appconfig->get('company_logo'); ?>" alt="company_logo" />
<img id="image" src="<?php echo 'uploads/' . $this->config->item('company_logo'); ?>" alt="company_logo" />
<?php
}
?>

View File

@@ -1,10 +1,10 @@
<div id="receipt_wrapper">
<div id="receipt_header">
<?php
if ($this->Appconfig->get('company_logo') != '')
if ($this->config->item('company_logo') != '')
{
?>
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->config->item('company_logo')); ?>" alt="company_logo" /></div>
<?php
}
?>
@@ -55,11 +55,11 @@
<td><?php echo ucfirst($item['name']); ?></td>
<td><?php echo to_currency($item['price']); ?></td>
<td><?php echo to_quantity_decimals($item['quantity']); ?></td>
<td class="total-value"><?php echo to_currency($item[($this->Appconfig->get('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
<td class="total-value"><?php echo to_currency($item[($this->config->item('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
</tr>
<tr>
<?php
if($this->Appconfig->get('receipt_show_description'))
if($this->config->item('receipt_show_description'))
{
?>
<td colspan="2"><?php echo $item['description']; ?></td>
@@ -67,7 +67,7 @@
}
?>
<?php
if($this->Appconfig->get('receipt_show_serialnumber'))
if($this->config->item('receipt_show_serialnumber'))
{
?>
<td><?php echo $item['serialnumber']; ?></td>
@@ -91,7 +91,7 @@
?>
<?php
if ($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)
if ($this->config->item('receipt_show_total_discount') && $discount > 0)
{
?>
<tr>
@@ -107,7 +107,7 @@
?>
<?php
if ($this->Appconfig->get('receipt_show_taxes'))
if ($this->config->item('receipt_show_taxes'))
{
?>
<tr>
@@ -132,7 +132,7 @@
<tr>
</tr>
<?php $border = (!$this->Appconfig->get('receipt_show_taxes') && !($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)); ?>
<?php $border = (!$this->config->item('receipt_show_taxes') && !($this->config->item('receipt_show_total_discount') && $discount > 0)); ?>
<tr>
<td colspan="3" style="text-align:right;<?php echo $border? 'border-top: 2px solid black;' :''; ?>"><?php echo $this->lang->line('sales_total'); ?></td>
<td style="text-align:right;<?php echo $border? 'border-top: 2px solid black;' :''; ?>"><?php echo to_currency($total); ?></td>

View File

@@ -1,10 +1,10 @@
<div id="receipt_wrapper" style="width:100%;">
<div id="receipt_header" style="text-align:center;">
<?php
if ($this->Appconfig->get('company_logo') != '')
if ($this->config->item('company_logo') != '')
{
?>
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->config->item('company_logo')); ?>" alt="company_logo" /></div>
<?php
}
?>
@@ -50,11 +50,11 @@
<td><?php echo ucfirst($item['name']); ?></td>
<td><?php echo to_currency($item['price']); ?></td>
<td><?php echo to_quantity_decimals($item['quantity']); ?></td>
<td style="text-align:right;"><?php echo to_currency($item[($this->Appconfig->get('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
<td style="text-align:right;"><?php echo to_currency($item[($this->config->item('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
</tr>
<tr>
<?php
if($this->Appconfig->get('receipt_show_description'))
if($this->config->item('receipt_show_description'))
{
?>
<td colspan="2"><?php echo $item['description']; ?></td>
@@ -62,7 +62,7 @@
}
?>
<?php
if($this->Appconfig->get('receipt_show_serialnumber'))
if($this->config->item('receipt_show_serialnumber'))
{
?>
<td><?php echo $item['serialnumber']; ?></td>
@@ -86,7 +86,7 @@
?>
<?php
if ($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)
if ($this->config->item('receipt_show_total_discount') && $discount > 0)
{
?>
<tr>
@@ -102,7 +102,7 @@
?>
<?php
if ($this->Appconfig->get('receipt_show_taxes'))
if ($this->config->item('receipt_show_taxes'))
{
?>
<tr>
@@ -127,7 +127,7 @@
<tr>
</tr>
<?php $border = (!$this->Appconfig->get('receipt_show_taxes') && !($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)); ?>
<?php $border = (!$this->config->item('receipt_show_taxes') && !($this->config->item('receipt_show_total_discount') && $discount > 0)); ?>
<tr>
<td colspan="3" style="<?php echo $border? 'border-top: 2px solid black;' :''; ?>text-align:right;"><?php echo $this->lang->line('sales_total'); ?></td>
<td style="<?php echo $border? 'border-top: 2px solid black;' :''; ?>text-align:right"><?php echo to_currency($total); ?></td>

View File

@@ -1,10 +1,10 @@
<div id="receipt_wrapper">
<div id="receipt_header">
<?php
if ($this->Appconfig->get('company_logo') != '')
if ($this->config->item('company_logo') != '')
{
?>
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->config->item('company_logo')); ?>" alt="company_logo" /></div>
<?php
}
?>
@@ -56,11 +56,11 @@
<tr>
<td><?php echo to_currency($item['price']); ?></td>
<td><?php echo to_quantity_decimals($item['quantity']); ?></td>
<td class="total-value"><?php echo to_currency($item[($this->Appconfig->get('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
<td class="total-value"><?php echo to_currency($item[($this->config->item('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
</tr>
<tr>
<?php
if($this->Appconfig->get('receipt_show_description'))
if($this->config->item('receipt_show_description'))
{
?>
<td colspan="2"><?php echo $item['description']; ?></td>
@@ -68,7 +68,7 @@
}
?>
<?php
if($this->Appconfig->get('receipt_show_serialnumber'))
if($this->config->item('receipt_show_serialnumber'))
{
?>
<td><?php echo $item['serialnumber']; ?></td>
@@ -92,7 +92,7 @@
?>
<?php
if ($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)
if ($this->config->item('receipt_show_total_discount') && $discount > 0)
{
?>
<tr>
@@ -108,7 +108,7 @@
?>
<?php
if ($this->Appconfig->get('receipt_show_taxes'))
if ($this->config->item('receipt_show_taxes'))
{
?>
<tr>
@@ -133,7 +133,7 @@
<tr>
</tr>
<?php $border = (!$this->Appconfig->get('receipt_show_taxes') && !($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)); ?>
<?php $border = (!$this->config->item('receipt_show_taxes') && !($this->config->item('receipt_show_total_discount') && $discount > 0)); ?>
<tr>
<td colspan="2" style="text-align:right;<?php echo $border? 'border-top: 2px solid black;' :''; ?>"><?php echo $this->lang->line('sales_total'); ?></td>
<td style="text-align:right;<?php echo $border? 'border-top: 2px solid black;' :''; ?>"><?php echo to_currency($total); ?></td>

View File

@@ -1,16 +1,16 @@
{
"name": "OpenSourcePOS",
"description": "Open Source Point of Sale is a web based POS system written in the PHP language. It uses MySQL as backend and has a simple user interface",
"version": "3.0.0",
"version": "3.0.1",
"license": "MIT",
"authors": [
"jekkos <jeroen.peelaerts - at - gmail.com>",
"FrancescoUK <francesco.lodolo.uk - at - gmail.com>"
],
"keywords": [
"point-of-sale",
"POS"
"POS"
],
"license": "MIT",
"homepage": "https://github.com/jekkos/opensourcepos",
"private": true,
"moduleType": [
@@ -40,6 +40,7 @@
"chartist-plugin-axistitle": "^0.1.0",
"chartist-plugin-pointlabels": "^0.0.4",
"chartist-plugin-tooltip": "^0.0.13",
"chartist-plugin-barlabels": "https://github.com/mtgibbs/chartist-plugin-barlabels.git#^0.0.5",
"remarkable-bootstrap-notify": "^3.1.3",
"js-cookie": "^2.1.3",
"blockUI": "*"

View File

@@ -1,11 +1,15 @@
{
"name": "OpenSourcePOS",
"description" : "Open Source Point of Sale is a web based POS system written in the PHP language. It uses MySQL as backend and has a simple user interface",
"version": "3.0.0",
"version": "3.0.1",
"license": "MIT",
"authors": [
"jekkos <jeroen.peelaerts - at - gmail.com>",
"FrancescoUK <francesco.lodolo.uk - at - gmail.com>"
{
"name": "jekkos"
},
{
"name": "FrancescoUK"
}
],
"type": "project",
"keywords": [
@@ -15,7 +19,7 @@
"homepage": "https://github.com/jekkos/opensourcepos",
"require": {
"php": ">=5.5",
"codeigniter/framework": "dev-develop#c4bd43432df03e4f4835c7689c8ed722cd2c3020",
"codeigniter/framework": "3.1.2",
"ins0/google-measurement-php-client": "dev-master#2b3aef2375837339f5b2bfe88e76994481f86264",
"dompdf/dompdf": "^0.7.0"
},

15
composer.lock generated
View File

@@ -4,21 +4,21 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "71dab0d424965628ef20cbd72fe6e151",
"content-hash": "8e04009f1dba7a7d1f2ba5101d238629",
"hash": "a3379d860fa0f4ff353e345a89542ac2",
"content-hash": "5a62415e3578c5a0a00b72a2e80f2aa0",
"packages": [
{
"name": "codeigniter/framework",
"version": "dev-develop",
"version": "3.1.2",
"source": {
"type": "git",
"url": "https://github.com/bcit-ci/CodeIgniter.git",
"reference": "c4bd43432df03e4f4835c7689c8ed722cd2c3020"
"reference": "2afa6b6b58a73fa26a7a93045ccb1fc8a087a141"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/c4bd43432df03e4f4835c7689c8ed722cd2c3020",
"reference": "c4bd43432df03e4f4835c7689c8ed722cd2c3020",
"url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/2afa6b6b58a73fa26a7a93045ccb1fc8a087a141",
"reference": "2afa6b6b58a73fa26a7a93045ccb1fc8a087a141",
"shasum": ""
},
"require": {
@@ -37,7 +37,7 @@
],
"description": "The CodeIgniter framework",
"homepage": "https://codeigniter.com",
"time": "2016-08-10 12:26:57"
"time": "2016-10-28 15:13:14"
},
{
"name": "dompdf/dompdf",
@@ -257,7 +257,6 @@
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"codeigniter/framework": 20,
"ins0/google-measurement-php-client": 20
},
"prefer-stable": false,

View File

@@ -9,6 +9,9 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
ALTER TABLE `ospos_sales_suspended`
DROP KEY `invoice_number`;
ALTER TABLE `ospos_items`
CHANGE COLUMN `item_pic` `pic_id` int(10) DEFAULT NULL;
-- Clear out emptied comments (0 inserted in comment if empty #192)
UPDATE `ospos_sales` SET comment = NULL WHERE comment = '0';
UPDATE `ospos_receivings` SET comment = NULL WHERE comment = '0';

View File

@@ -771,6 +771,9 @@ SELECT `key`, `value` FROM `phppos`.phppos_app_config WHERE `key` = 'fax';
DELETE FROM `ospos_app_config` WHERE `key` = 'phone';
INSERT INTO `ospos_app_config` (`key`, `value`)
SELECT `key`, `value` FROM `phppos`.phppos_app_config WHERE `key` = 'phone';
DELETE FROM `ospos_app_config` WHERE `key` = 'website';
INSERT INTO `ospos_app_config` (`key`, `value`)
SELECT `key`, `value` FROM `phppos`.phppos_app_config WHERE `key` = 'website';
DELETE FROM `ospos_app_config` WHERE `key` = 'return_policy';
INSERT INTO `ospos_app_config` (`key`, `value`)
SELECT `key`, `value` FROM `phppos`.phppos_app_config WHERE `key` = 'return_policy';
@@ -787,8 +790,8 @@ UPDATE `ospos_customers` c1, `ospos_customers` c2 SET `c1`.`account_number` = NU
-- Copy data to table `ospos_employees`
--
INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`)
SELECT `username`, `password`, `person_id`, `deleted` FROM `phppos`.phppos_employees;
INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`, `hash_version`)
SELECT `username`, `password`, `person_id`, `deleted`, 1 FROM `phppos`.phppos_employees;
--
-- Copy data to table `ospos_giftcards`
@@ -850,8 +853,8 @@ SELECT `receiving_time`, `supplier_id`, `employee_id`, `comment`, `receiving_id`
-- Copy data to table `ospos_receivings_items`
--
INSERT INTO `ospos_receivings_items` (`receiving_id`, `item_id`, `description`, `serialnumber`, `line`, `quantity_purchased`, `item_cost_price`, `item_unit_price`, `discount_percent`)
SELECT `receiving_id`, `item_id`, `description`, `serialnumber`, `line`, `quantity_purchased`, `item_cost_price`, `item_unit_price`, `discount_percent` FROM `phppos`.phppos_receivings_items;
INSERT INTO `ospos_receivings_items` (`receiving_id`, `item_id`, `description`, `serialnumber`, `line`, `quantity_purchased`, `item_cost_price`, `item_unit_price`, `discount_percent`, `item_location`)
SELECT `receiving_id`, `item_id`, `description`, `serialnumber`, `line`, `quantity_purchased`, `item_cost_price`, `item_unit_price`, `discount_percent`, 1 FROM `phppos`.phppos_receivings_items;
--
-- Copy data to table `ospos_sales`
@@ -896,11 +899,6 @@ INSERT INTO `ospos_suppliers` (`person_id`, `company_name`, `account_number`, `d
SELECT `person_id`, `company_name`, `account_number`, `deleted` FROM `phppos`.phppos_suppliers;
--
-- Add constraints on copied data
--
--
-- Constraints for dumped tables
--

View File

@@ -36,6 +36,9 @@ SELECT `key`, `value` FROM `phppos`.phppos_app_config WHERE `key` = 'fax';
DELETE FROM `ospos_app_config` WHERE `key` = 'phone';
INSERT INTO `ospos_app_config` (`key`, `value`)
SELECT `key`, `value` FROM `phppos`.phppos_app_config WHERE `key` = 'phone';
DELETE FROM `ospos_app_config` WHERE `key` = 'website';
INSERT INTO `ospos_app_config` (`key`, `value`)
SELECT `key`, `value` FROM `phppos`.phppos_app_config WHERE `key` = 'website';
DELETE FROM `ospos_app_config` WHERE `key` = 'return_policy';
INSERT INTO `ospos_app_config` (`key`, `value`)
SELECT `key`, `value` FROM `phppos`.phppos_app_config WHERE `key` = 'return_policy';
@@ -52,8 +55,8 @@ UPDATE `ospos_customers` c1, `ospos_customers` c2 SET `c1`.`account_number` = NU
-- Copy data to table `ospos_employees`
--
INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`)
SELECT `username`, `password`, `person_id`, `deleted` FROM `phppos`.phppos_employees;
INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`, `hash_version`)
SELECT `username`, `password`, `person_id`, `deleted`, 1 FROM `phppos`.phppos_employees;
--
-- Copy data to table `ospos_giftcards`
@@ -115,8 +118,8 @@ SELECT `receiving_time`, `supplier_id`, `employee_id`, `comment`, `receiving_id`
-- Copy data to table `ospos_receivings_items`
--
INSERT INTO `ospos_receivings_items` (`receiving_id`, `item_id`, `description`, `serialnumber`, `line`, `quantity_purchased`, `item_cost_price`, `item_unit_price`, `discount_percent`)
SELECT `receiving_id`, `item_id`, `description`, `serialnumber`, `line`, `quantity_purchased`, `item_cost_price`, `item_unit_price`, `discount_percent` FROM `phppos`.phppos_receivings_items;
INSERT INTO `ospos_receivings_items` (`receiving_id`, `item_id`, `description`, `serialnumber`, `line`, `quantity_purchased`, `item_cost_price`, `item_unit_price`, `discount_percent`, `item_location`)
SELECT `receiving_id`, `item_id`, `description`, `serialnumber`, `line`, `quantity_purchased`, `item_cost_price`, `item_unit_price`, `discount_percent`, 1 FROM `phppos`.phppos_receivings_items;
--
-- Copy data to table `ospos_sales`
@@ -160,8 +163,3 @@ SELECT `item_id`, 1, `quantity` FROM `phppos`.`phppos_items`;
INSERT INTO `ospos_suppliers` (`person_id`, `company_name`, `account_number`, `deleted`)
SELECT `person_id`, `company_name`, `account_number`, `deleted` FROM `phppos`.phppos_suppliers;
--
-- Add constraints on copied data
--

BIN
design/database-layout.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

BIN
design/databaselayout.mwb Normal file
View File

Binary file not shown.

BIN
design/item_attributes.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

BIN
design/ospos_categories.mwb Normal file
View File

Binary file not shown.

View File

@@ -9,7 +9,7 @@ web:
roles:
- global
volumes:
- /app/uploads
- /app/public/uploads
environment:
- PHP_TIMEZONE=UTC
- MYSQL_USERNAME=admin

View File

@@ -1,8 +1,13 @@
{
"name": "opensourcepos",
"version": "3.0.0",
"version": "3.0.1",
"description": "Open Source Point of Sale is a web based point of sale system written in the PHP language. It uses MySQL as the data storage back-end and has a simple user interface.",
"main": "index.php",
"license": "MIT",
"authors": [
"jekkos <jeroen.peelaerts - at - gmail.com>",
"FrancescoUK <francesco.lodolo.uk - at - gmail.com>"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
@@ -14,8 +19,6 @@
"point-of-sale",
"POS"
],
"author": "jekkos",
"license": "MIT",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-bower": "^0.21.0",

View File

@@ -24,11 +24,36 @@ RewriteRule ^(.*)$ index.php?/$1 [L]
#Options All -Indexes
Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes
# secure htaccess file
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
# prevent folder listing
IndexIgnore *
# Apache 2.4
<IfModule authz_core_module>
# secure htaccess file
<Files .htaccess>
Require all denied
</Files>
# prevent access to PHP error log
<Files error_log>
Require all denied
</Files>
</IfModule>
# Apache 2.2
<IfModule !authz_core_module>
# secure htaccess file
<Files .htaccess>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to PHP error log
<Files error_log>
Order allow,deny
Deny from all
Satisfy all
</Files>
</IfModule>
<IfModule mod_expires.c>
<FilesMatch "\.(jpe?g|png|gif|js|css)$">

View File

File diff suppressed because one or more lines are too long

View File

@@ -53,7 +53,7 @@
*
* NOTE: If you change these, also change the error_reporting() code below
*/
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');
/*
*---------------------------------------------------------------

View File

@@ -343,4 +343,13 @@ $(document).ready(function() {
if (session_sha1 != footer_sha1 || !footer_text.match(/Open Source Point Of Sale/)) {
$(window).block({ message: '' });
}
});
});
function number_sorter(a, b)
{
a = +a.replace(/[^\-0-9\.]+/g,"");
b = +b.replace(/[^\-0-9\.]+/g,"");
if (a > b) return 1;
if (a < b) return -1;
return 0;
}

View File

@@ -10,6 +10,7 @@ Copyright (c) 2015-2016 FrancescoUK (aka daN4cat)
Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com
Copyright (c) 2015 Toni Haryanto (aka yllumi)
Copyright (c) 2016 Ramkrishna Mondal (aka RamkrishnaMondal)
Copyright (c) 2016 Rinaldy@dbarber (aka rnld26)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@@ -1,52 +1,4 @@
{
"chartist-plugin-tooltip@0.0.13": {
"licenses": [
"MIT*"
],
"homepage": "https://github.com/Globegitter/chartist-plugin-tooltip"
},
"chartist@0.9.8": {
"licenses": "UNKNOWN",
"homepage": "https://github.com/gionkunz/chartist-js"
},
"bootswatch@3.3.7": {
"licenses": [
"MIT"
],
"repository": {
"type": "git",
"url": "git://github.com/thomaspark/bootswatch.git"
},
"homepage": "http://bootswatch.com"
},
"tableExport.jquery.plugin@1.5.1": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/hhurz/tableExport.jquery.plugin"
},
"jquery-form@3.46.0": {
"licenses": "UNKNOWN",
"homepage": "https://github.com/malsup/form"
},
"file-saver.js@1.20150507.2": {
"licenses": [
"LICENSE.md"
],
"homepage": "https://github.com/Teleborder/FileSaver.js"
},
"chartist-plugin-pointlabels@0.0.4": {
"licenses": [
"WTF*"
],
"homepage": "https://github.com/gionkunz/chartist-plugin-pointlabels"
},
"chartist-plugin-axistitle@0.1.0": {
"licenses": [
"WTF*"
],
"homepage": "https://github.com/alexstanbury/chartist-plugin-axistitle"
},
"blockUI@undefined": {
"licenses": [
"MIT*"
@@ -59,23 +11,65 @@
],
"homepage": "http://silviomoreto.github.io/bootstrap-select"
},
"jquery@1.12.4": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/jquery/jquery-dist"
},
"bootstrap3-dialog@1.35.3": {
"licenses": [
"MIT"
],
"homepage": "http://nakupanda.github.io/bootstrap3-dialog/"
},
"js-cookie@2.1.3": {
"bootswatch@3.3.7": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/js-cookie/js-cookie"
"repository": {
"type": "git",
"url": "git://github.com/thomaspark/bootswatch.git"
},
"homepage": "http://bootswatch.com"
},
"chartist@0.9.8": {
"licenses": "UNKNOWN",
"homepage": "https://github.com/gionkunz/chartist-js"
},
"chartist-plugin-axistitle@0.1.0": {
"licenses": [
"WTF*"
],
"homepage": "https://github.com/alexstanbury/chartist-plugin-axistitle"
},
"chartist-plugin-pointlabels@0.0.4": {
"licenses": [
"WTF*"
],
"homepage": "https://github.com/gionkunz/chartist-plugin-pointlabels"
},
"chartist-plugin-barlabels@0.0.5": {
"licenses": [
"WTF*"
],
"homepage": "https://github.com/mtgibbs/chartist-plugin-barlabels"
},
"chartist-plugin-tooltip@0.0.13": {
"licenses": [
"MIT*"
],
"homepage": "https://github.com/Globegitter/chartist-plugin-tooltip"
},
"file-saver.js@1.20150507.2": {
"licenses": [
"LICENSE.md"
],
"homepage": "https://github.com/Teleborder/FileSaver.js"
},
"jquery@1.12.4": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/jquery/jquery-dist"
},
"jquery-form@3.46.0": {
"licenses": "UNKNOWN",
"homepage": "https://github.com/malsup/form"
},
"jspdf@1.0.272": {
"licenses": [
@@ -83,12 +77,44 @@
],
"homepage": "https://github.com/mrrio/jspdf"
},
"remarkable-bootstrap-notify@3.1.3": {
"js-cookie@2.1.3": {
"licenses": [
"MIT"
],
"homepage": "http://bootstrap-notify.remabledesigns.com/",
"repository": "https://github.com/mouse0270/bootstrap-notify"
"homepage": "https://github.com/js-cookie/js-cookie"
},
"moment@2.15.1": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/moment/moment"
},
"tableExport.jquery.plugin@1.5.1": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/hhurz/tableExport.jquery.plugin"
},
"bootstrap-daterangepicker@2.1.24": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/dangrossman/bootstrap-daterangepicker",
"repository": "git+https://github.com/dangrossman/bootstrap-daterangepicker"
},
"bootstrap-table@undefined": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/wenzhixin/bootstrap-table",
"repository": "git+https://github.com/wenzhixin/bootstrap-table"
},
"html2canvas@0.4.1": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/niklasvh/html2canvas",
"repository": "git+ssh://git@github.com/niklasvh/html2canvas"
},
"jasny-bootstrap@3.1.3": {
"licenses": [
@@ -105,27 +131,6 @@
"repository": "https://github.com/jzaefferer/jquery-validation",
"homepage": "http://jqueryvalidation.org/"
},
"smalot-bootstrap-datetimepicker@2.3.11": {
"licenses": [
"Apache 2.0",
"Apache*"
],
"homepage": "https://github.com/smalot/bootstrap-datetimepicker",
"repository": "https://github.com/smalot/bootstrap-datetimepicker"
},
"moment@2.15.1": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/moment/moment"
},
"bootstrap-table@undefined": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/wenzhixin/bootstrap-table",
"repository": "git+https://github.com/wenzhixin/bootstrap-table"
},
"bootstrap@3.3.7": {
"licenses": [
"MIT"
@@ -133,13 +138,6 @@
"homepage": "http://getbootstrap.com",
"repository": "git+https://github.com/twbs/bootstrap"
},
"html2canvas@0.4.1": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/niklasvh/html2canvas",
"repository": "git+ssh://git@github.com/niklasvh/html2canvas"
},
"jspdf-autotable@2.0.14": {
"licenses": [
"MIT"
@@ -147,12 +145,20 @@
"homepage": "https://github.com/simonbengtsson/jspdf-autotable",
"repository": "git+https://github.com/simonbengtsson/jsPDF-AutoTable"
},
"bootstrap-daterangepicker@2.1.24": {
"remarkable-bootstrap-notify@3.1.3": {
"licenses": [
"MIT"
],
"homepage": "https://github.com/dangrossman/bootstrap-daterangepicker",
"repository": "git+https://github.com/dangrossman/bootstrap-daterangepicker"
"homepage": "http://bootstrap-notify.remabledesigns.com/",
"repository": "https://github.com/mouse0270/bootstrap-notify"
},
"smalot-bootstrap-datetimepicker@2.3.11": {
"licenses": [
"Apache 2.0",
"Apache*"
],
"homepage": "https://github.com/smalot/bootstrap-datetimepicker",
"repository": "https://github.com/smalot/bootstrap-datetimepicker"
},
"jquery-ui@1.11.4": {
"licenses": [

View File

@@ -1,12 +1,12 @@
{
"name": "__root__",
"version": "dev-feature/composer",
"name": "OpenSourcePOS",
"version": "3.0.1",
"license": [
"MIT"
],
"dependencies": {
"codeigniter/framework": {
"version": "3.1.0",
"version": "3.1.2",
"license": [
"MIT"
]
@@ -18,11 +18,17 @@
]
},
"ins0/google-measurement-php-client": {
"version": "v2.1.1",
"version": "dev-master 2b3aef2",
"license": [
"BSD-3-Clause"
]
},
"mikey179/vfsStream": {
"version": "v1.1.0",
"license": [
"BSD"
]
},
"phenx/php-font-lib": {
"version": "0.4",
"license": [

View File

@@ -1 +0,0 @@
<?php echo phpinfo();

View File

@@ -1,45 +0,0 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7
- hhvm
env:
- DB=mysql
- DB=mysqli
- DB=pgsql
- DB=sqlite
- DB=pdo/mysql
- DB=pdo/pgsql
- DB=pdo/sqlite
sudo: false
before_script:
- sh -c "composer install --dev --no-progress"
- sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS ci_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ] || [ '$DB' = 'mysqli' ] || [ '$DB' = 'pdo/mysql' ]; then mysql -e 'create database IF NOT EXISTS ci_test;'; fi"
script: phpunit -d zend.enable_gc=0 -d date.timezone=UTC --coverage-text --configuration tests/travis/$DB.phpunit.xml
matrix:
allow_failures:
- php: hhvm
exclude:
- php: hhvm
env: DB=pgsql
- php: hhvm
env: DB=pdo/pgsql
- php: 7
env: DB=mysql
branches:
only:
- develop
- 3.0-stable
- 3.1-stable
- /^feature\/.+$/

View File

@@ -1,25 +0,0 @@
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(1) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(2) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(3) The contribution was provided directly to me by some other
person who certified (1), (2) or (3) and I have not modified
it.
(4) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

View File

@@ -63,8 +63,6 @@ $config['uri_protocol'] = 'REQUEST_URI';
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
|
| Note: This option is ignored for CLI requests.
*/
$config['url_suffix'] = '';
@@ -159,8 +157,6 @@ $config['composer_autoload'] = FALSE;
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
| Note: This option is ignored for CLI requests.
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

View File

@@ -163,5 +163,21 @@ return array(
'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')
'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'
);

View File

@@ -43,8 +43,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes with
| underscores in the controller and method URI segments.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method

View File

@@ -87,8 +87,7 @@ $browsers = array(
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser',
'Vivaldi' => 'Vivaldi'
'Ubuntu' => 'Ubuntu Web Browser'
);
$mobiles = array(

View File

@@ -29,7 +29,7 @@ If you change anything that requires a change to documentation then you will nee
### Compatibility
CodeIgniter recommends PHP 5.5 or newer to be used, but it should be
CodeIgniter recommends PHP 5.4 or newer to be used, but it should be
compatible with PHP 5.2.4 so all code supplied must stick to this
requirement. If PHP 5.3 (and above) functions or features are used then
there must be a fallback for PHP 5.2.4.

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title>CodeIgniter v3.0.0 API</title>
<parser>
<target>./api/</target>
</parser>
<transformer>
<target>./api/</target>
</transformer>
<files>
<directory>./system</directory>
</files>
<logging>
<level>warn</level>
<paths>
<default>./api/log/{DATE}.log</default>
<errors>./api/{DATE}.errors.log</errors>
</paths>
</logging>
</phpdoc>

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