Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Sep 14, 2017
0 parents commit 515bdaf
Show file tree
Hide file tree
Showing 598 changed files with 48,030 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text eol=lf

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.otf binary
*.eot binary
*.svg binary
*.ttf binary
*.woff binary
*.woff2 binary

*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
.env
robots.txt
_ide_helper.php
.phpstorm.meta.php
composer.lock
20 changes: 20 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
674 changes: 674 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Akaunting™

[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)

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.

* [Home](https://akaunting.com) - The house of Akaunting
* [Blog](https://akaunting.com/blog) - Get the latest news
* [Forum](https://akaunting.com/forum) - Join the community
* [Documentation](https://akaunting.com/docs) - Learn more about Akaunting

## Requirements

* PHP 5.6.4 or higher
* Database (eg: MySQL, PostgreSQL, SQLite)
* Web Server (eg: Apache, Nginx, IIS)
* [Other libraries](https://akaunting.com/docs/requirements)

## Framework

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.

## Installation

* Install [Composer](https://getcomposer.org/download)
* Download the [repository](https://github.com/akaunting/akaunting/archive/master.zip) and unzip into your server
* Open and point your command line to the directory you unzipped Akaunting
* Run the following command: `composer install`
* Finally, go to the Akaunting folder via your browser

## Contributing

Fork the repository, make the code changes then submit a pull request.

Please, be very clear on your commit messages and pull requests, empty pull request messages may be rejected without reason.

When contributing code to Akaunting, you must follow the PSR coding standards. The golden rule is: Imitate the existing Akaunting code.

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.

## Translation

If you'd like to contribute translations, please check out our [Crowdin](https://crowdin.com/project/akaunting) project.

## Changelog

Please see [Releases](../../releases) for more information what has changed recently.

## Security

If you discover any security related issues, please email security[at]akaunting[dot]com instead of using the issue tracker.

## Credits

- [Denis Duliçi](https://github.com/denisdulici)
- [Cüneyt Şentürk](https://github.com/cuneytsenturk)
- [All Contributors](../../contributors)

## License

Akaunting is released under the [GPLv3 license](LICENSE.txt).
80 changes: 80 additions & 0 deletions app/Console/Commands/BillReminder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

namespace App\Console\Commands;

use App\Models\Company\Company;
use App\Models\Expense\Bill;
use App\Notifications\Expense\Bill as Notification;

use Jenssegers\Date\Date;
use Illuminate\Console\Command;

class BillReminder extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'reminder:bill';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Send reminders for bills';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// Get all companies
$companies = Company::all();

foreach ($companies as $company) {
$company->setSettings();

//$days = explode(',', setting('general.schedule_bill_days', '1,3'));
$days = explode(',', $company->schedule_bill_days);

foreach ($days as $day) {
$this->remind(trim($day), $company);
}
}
}

protected function remind($day, $company)
{
// Get due date
$date = Date::today()->addDays($day)->toDateString();

// Get upcoming bills
$bills = Bill::companyId($company->id)->due($date)->with('vendor')->get();

foreach ($bills as $bill) {
// Notify all users assigned to this company
foreach ($company->users as $user) {
if (!$user->can('read-notifications')) {
continue;
}

$user->notify(new Notification($bill));
}
}
}

}
47 changes: 47 additions & 0 deletions app/Console/Commands/CompanySeed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class CompanySeed extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'company:seed {company}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Seed for specific company';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$class = $this->laravel->make('CompanySeeder');

$seeder = $class->setContainer($this->laravel)->setCommand($this);

$seeder->__invoke();
}

}
83 changes: 83 additions & 0 deletions app/Console/Commands/InvoiceReminder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace App\Console\Commands;

use App\Models\Company\Company;
use App\Models\Income\Invoice;
use App\Notifications\Income\Invoice as Notification;

use Jenssegers\Date\Date;
use Illuminate\Console\Command;

class InvoiceReminder extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'reminder:invoice';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Send reminders for invoices';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// Get all companies
$companies = Company::all();

foreach ($companies as $company) {
$company->setSettings();

//$days = explode(',', config('general.schedule_invoice_days', '1,3'));
$days = explode(',', $company->schedule_invoice_days);

foreach ($days as $day) {
$this->remind(trim($day), $company);
}
}
}

protected function remind($day, $company)
{
// Get due date
$date = Date::today()->subDays($day)->toDateString();

// Get upcoming bills
$invoices = Invoice::companyId($company->id)->due($date)->with('customer')->get();

foreach ($invoices as $invoice) {
// Notify the customer
$invoice->customer->notify(new Notification($invoice));

// Notify all users assigned to this company
foreach ($company->users as $user) {
if (!$user->can('read-notifications')) {
continue;
}

$user->notify(new Notification($invoice));
}
}
}

}
47 changes: 47 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\CompanySeed::class,
Commands\BillReminder::class,
Commands\InvoiceReminder::class,
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// Not installed yet
if (env('DB_DATABASE', '') == '') {
return;
}

$schedule->command('reminder:invoice')->dailyAt(setting('general.schedule_time', '09:00'));
$schedule->command('reminder:bill')->dailyAt(setting('general.schedule_time', '09:00'));
}

/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
require base_path('routes/console.php');
}
}
Loading

0 comments on commit 515bdaf

Please sign in to comment.