Skip to content

Commit 515bdaf

Browse files
committed
first commit
0 parents  commit 515bdaf

File tree

598 files changed

+48030
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

598 files changed

+48030
-0
lines changed

.gitattributes

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text eol=lf
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.c text
7+
*.h text
8+
9+
# Declare files that will always have CRLF line endings on checkout.
10+
*.sln text eol=crlf
11+
12+
# Denote all files that are truly binary and should not be modified.
13+
*.png binary
14+
*.jpg binary
15+
*.otf binary
16+
*.eot binary
17+
*.svg binary
18+
*.ttf binary
19+
*.woff binary
20+
*.woff2 binary
21+
22+
*.css linguist-vendored
23+
*.scss linguist-vendored
24+
*.js linguist-vendored
25+
CHANGELOG.md export-ignore

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
/.idea
7+
/.vagrant
8+
Homestead.json
9+
Homestead.yaml
10+
npm-debug.log
11+
.env
12+
robots.txt
13+
_ide_helper.php
14+
.phpstorm.meta.php
15+
composer.lock

.htaccess

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<IfModule mod_rewrite.c>
2+
<IfModule mod_negotiation.c>
3+
Options -MultiViews
4+
</IfModule>
5+
6+
RewriteEngine On
7+
8+
# Redirect Trailing Slashes If Not A Folder...
9+
RewriteCond %{REQUEST_FILENAME} !-d
10+
RewriteRule ^(.*)/$ /$1 [L,R=301]
11+
12+
# Handle Front Controller...
13+
RewriteCond %{REQUEST_FILENAME} !-d
14+
RewriteCond %{REQUEST_FILENAME} !-f
15+
RewriteRule ^ index.php [L]
16+
17+
# Handle Authorization Header
18+
RewriteCond %{HTTP:Authorization} .
19+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
20+
</IfModule>

LICENSE.txt

+674
Large diffs are not rendered by default.

README.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Akaunting™
2+
3+
[Latest Stable Version](https://img.shields.io/github/release/akaunting/akaunting.svg) [Total Downloads](https://img.shields.io/github/downloads/akaunting/akaunting/total.svg) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/akaunting/localized.png)](https://crowdin.com/project/akaunting) [License](https://img.shields.io/github/license/akaunting/akaunting.svg)
4+
5+
Akaunting is a free, online and open source accounting software designed for small businesses and freelancers. It is built with modern technologies such as Laravel, Bootstrap, jQuery, RESTful API etc. Thanks to its modular structure, Akaunting provides an awesome App Store for users and developers.
6+
7+
* [Home](https://akaunting.com) - The house of Akaunting
8+
* [Blog](https://akaunting.com/blog) - Get the latest news
9+
* [Forum](https://akaunting.com/forum) - Join the community
10+
* [Documentation](https://akaunting.com/docs) - Learn more about Akaunting
11+
12+
## Requirements
13+
14+
* PHP 5.6.4 or higher
15+
* Database (eg: MySQL, PostgreSQL, SQLite)
16+
* Web Server (eg: Apache, Nginx, IIS)
17+
* [Other libraries](https://akaunting.com/docs/requirements)
18+
19+
## Framework
20+
21+
Akaunting uses [Laravel](http://laravel.com), the best existing PHP framework, as the foundation framework and [Laravel Modules](https://nwidart.com/laravel-modules) package for Apps.
22+
23+
## Installation
24+
25+
* Install [Composer](https://getcomposer.org/download)
26+
* Download the [repository](https://github.com/akaunting/akaunting/archive/master.zip) and unzip into your server
27+
* Open and point your command line to the directory you unzipped Akaunting
28+
* Run the following command: `composer install`
29+
* Finally, go to the Akaunting folder via your browser
30+
31+
## Contributing
32+
33+
Fork the repository, make the code changes then submit a pull request.
34+
35+
Please, be very clear on your commit messages and pull requests, empty pull request messages may be rejected without reason.
36+
37+
When contributing code to Akaunting, you must follow the PSR coding standards. The golden rule is: Imitate the existing Akaunting code.
38+
39+
Please note that this project is released with a [Contributor Code of Conduct](https://akaunting.com/code-of-conduct). By participating in this project you agree to abide by its terms.
40+
41+
## Translation
42+
43+
If you'd like to contribute translations, please check out our [Crowdin](https://crowdin.com/project/akaunting) project.
44+
45+
## Changelog
46+
47+
Please see [Releases](../../releases) for more information what has changed recently.
48+
49+
## Security
50+
51+
If you discover any security related issues, please email security[at]akaunting[dot]com instead of using the issue tracker.
52+
53+
## Credits
54+
55+
- [Denis Duliçi](https://github.com/denisdulici)
56+
- [Cüneyt Şentürk](https://github.com/cuneytsenturk)
57+
- [All Contributors](../../contributors)
58+
59+
## License
60+
61+
Akaunting is released under the [GPLv3 license](LICENSE.txt).

app/Console/Commands/BillReminder.php

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Models\Company\Company;
6+
use App\Models\Expense\Bill;
7+
use App\Notifications\Expense\Bill as Notification;
8+
9+
use Jenssegers\Date\Date;
10+
use Illuminate\Console\Command;
11+
12+
class BillReminder extends Command
13+
{
14+
/**
15+
* The name and signature of the console command.
16+
*
17+
* @var string
18+
*/
19+
protected $signature = 'reminder:bill';
20+
21+
/**
22+
* The console command description.
23+
*
24+
* @var string
25+
*/
26+
protected $description = 'Send reminders for bills';
27+
28+
/**
29+
* Create a new command instance.
30+
*
31+
* @return void
32+
*/
33+
public function __construct()
34+
{
35+
parent::__construct();
36+
}
37+
38+
/**
39+
* Execute the console command.
40+
*
41+
* @return mixed
42+
*/
43+
public function handle()
44+
{
45+
// Get all companies
46+
$companies = Company::all();
47+
48+
foreach ($companies as $company) {
49+
$company->setSettings();
50+
51+
//$days = explode(',', setting('general.schedule_bill_days', '1,3'));
52+
$days = explode(',', $company->schedule_bill_days);
53+
54+
foreach ($days as $day) {
55+
$this->remind(trim($day), $company);
56+
}
57+
}
58+
}
59+
60+
protected function remind($day, $company)
61+
{
62+
// Get due date
63+
$date = Date::today()->addDays($day)->toDateString();
64+
65+
// Get upcoming bills
66+
$bills = Bill::companyId($company->id)->due($date)->with('vendor')->get();
67+
68+
foreach ($bills as $bill) {
69+
// Notify all users assigned to this company
70+
foreach ($company->users as $user) {
71+
if (!$user->can('read-notifications')) {
72+
continue;
73+
}
74+
75+
$user->notify(new Notification($bill));
76+
}
77+
}
78+
}
79+
80+
}

app/Console/Commands/CompanySeed.php

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
7+
class CompanySeed extends Command
8+
{
9+
/**
10+
* The name and signature of the console command.
11+
*
12+
* @var string
13+
*/
14+
protected $signature = 'company:seed {company}';
15+
16+
/**
17+
* The console command description.
18+
*
19+
* @var string
20+
*/
21+
protected $description = 'Seed for specific company';
22+
23+
/**
24+
* Create a new command instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
parent::__construct();
31+
}
32+
33+
/**
34+
* Execute the console command.
35+
*
36+
* @return mixed
37+
*/
38+
public function handle()
39+
{
40+
$class = $this->laravel->make('CompanySeeder');
41+
42+
$seeder = $class->setContainer($this->laravel)->setCommand($this);
43+
44+
$seeder->__invoke();
45+
}
46+
47+
}
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Models\Company\Company;
6+
use App\Models\Income\Invoice;
7+
use App\Notifications\Income\Invoice as Notification;
8+
9+
use Jenssegers\Date\Date;
10+
use Illuminate\Console\Command;
11+
12+
class InvoiceReminder extends Command
13+
{
14+
/**
15+
* The name and signature of the console command.
16+
*
17+
* @var string
18+
*/
19+
protected $signature = 'reminder:invoice';
20+
21+
/**
22+
* The console command description.
23+
*
24+
* @var string
25+
*/
26+
protected $description = 'Send reminders for invoices';
27+
28+
/**
29+
* Create a new command instance.
30+
*
31+
* @return void
32+
*/
33+
public function __construct()
34+
{
35+
parent::__construct();
36+
}
37+
38+
/**
39+
* Execute the console command.
40+
*
41+
* @return mixed
42+
*/
43+
public function handle()
44+
{
45+
// Get all companies
46+
$companies = Company::all();
47+
48+
foreach ($companies as $company) {
49+
$company->setSettings();
50+
51+
//$days = explode(',', config('general.schedule_invoice_days', '1,3'));
52+
$days = explode(',', $company->schedule_invoice_days);
53+
54+
foreach ($days as $day) {
55+
$this->remind(trim($day), $company);
56+
}
57+
}
58+
}
59+
60+
protected function remind($day, $company)
61+
{
62+
// Get due date
63+
$date = Date::today()->subDays($day)->toDateString();
64+
65+
// Get upcoming bills
66+
$invoices = Invoice::companyId($company->id)->due($date)->with('customer')->get();
67+
68+
foreach ($invoices as $invoice) {
69+
// Notify the customer
70+
$invoice->customer->notify(new Notification($invoice));
71+
72+
// Notify all users assigned to this company
73+
foreach ($company->users as $user) {
74+
if (!$user->can('read-notifications')) {
75+
continue;
76+
}
77+
78+
$user->notify(new Notification($invoice));
79+
}
80+
}
81+
}
82+
83+
}

app/Console/Kernel.php

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
Commands\CompanySeed::class,
17+
Commands\BillReminder::class,
18+
Commands\InvoiceReminder::class,
19+
];
20+
21+
/**
22+
* Define the application's command schedule.
23+
*
24+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
25+
* @return void
26+
*/
27+
protected function schedule(Schedule $schedule)
28+
{
29+
// Not installed yet
30+
if (env('DB_DATABASE', '') == '') {
31+
return;
32+
}
33+
34+
$schedule->command('reminder:invoice')->dailyAt(setting('general.schedule_time', '09:00'));
35+
$schedule->command('reminder:bill')->dailyAt(setting('general.schedule_time', '09:00'));
36+
}
37+
38+
/**
39+
* Register the Closure based commands for the application.
40+
*
41+
* @return void
42+
*/
43+
protected function commands()
44+
{
45+
require base_path('routes/console.php');
46+
}
47+
}

0 commit comments

Comments
 (0)