mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 12:54:31 -04:00
Working on client statement schedules
This commit is contained in:
parent
b0f8e10430
commit
ada6210e34
@ -60,8 +60,15 @@ class TaskScheduler implements ShouldQueue
|
|||||||
private function doJob(Scheduler $scheduler)
|
private function doJob(Scheduler $scheduler)
|
||||||
{
|
{
|
||||||
nlog("Doing job {$scheduler->name}");
|
nlog("Doing job {$scheduler->name}");
|
||||||
//
|
|
||||||
//
|
try {
|
||||||
|
$scheduler->service()->runTask();
|
||||||
|
}
|
||||||
|
catch(\Exception $e){
|
||||||
|
nlog($e->getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,49 +11,82 @@
|
|||||||
|
|
||||||
namespace App\Services\Scheduler;
|
namespace App\Services\Scheduler;
|
||||||
|
|
||||||
|
use App\Models\Client;
|
||||||
use App\Models\Scheduler;
|
use App\Models\Scheduler;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class SchedulerService
|
class SchedulerService
|
||||||
{
|
{
|
||||||
|
use MakesHash;
|
||||||
|
|
||||||
|
private string $method;
|
||||||
|
|
||||||
public function __construct(public Scheduler $scheduler) {}
|
public function __construct(public Scheduler $scheduler) {}
|
||||||
|
|
||||||
public function scheduleStatement()
|
/**
|
||||||
|
* Called from the TaskScheduler Cron
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function runTask(): void
|
||||||
{
|
{
|
||||||
|
$this->{$this->scheduler->template}();
|
||||||
//Is it for one client
|
|
||||||
//Is it for all clients
|
|
||||||
//Is it for all clients excluding these clients
|
|
||||||
|
|
||||||
//Frequency
|
|
||||||
|
|
||||||
//show aging
|
|
||||||
//show payments
|
|
||||||
//paid/unpaid
|
|
||||||
|
|
||||||
//When to send? 1st of month
|
|
||||||
//End of month
|
|
||||||
//This date
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scheduleReport()
|
private function client_statement()
|
||||||
{
|
{
|
||||||
//Report type
|
$query = Client::query()
|
||||||
//same schema as ScheduleStatement
|
->where('company_id', $this->scheduler->company_id);
|
||||||
|
|
||||||
|
//Email only the selected clients
|
||||||
|
if(count($this->scheduler->parameters['clients']) >= 1)
|
||||||
|
$query->where('id', $this->transformKeys($this->scheduler->parameters['clients']));
|
||||||
|
|
||||||
|
$query->cursor()
|
||||||
|
->each(function ($client){
|
||||||
|
|
||||||
|
//work out the date range
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scheduleEntitySend()
|
// public function scheduleStatement()
|
||||||
{
|
// {
|
||||||
//Entity
|
|
||||||
//Entity Id
|
|
||||||
//When
|
|
||||||
}
|
|
||||||
|
|
||||||
public function projectStatus()
|
// //Is it for one client
|
||||||
{
|
// //Is it for all clients
|
||||||
//Project ID
|
// //Is it for all clients excluding these clients
|
||||||
//Tasks - task statuses
|
|
||||||
}
|
// //Frequency
|
||||||
|
|
||||||
|
// //show aging
|
||||||
|
// //show payments
|
||||||
|
// //paid/unpaid
|
||||||
|
|
||||||
|
// //When to send? 1st of month
|
||||||
|
// //End of month
|
||||||
|
// //This date
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function scheduleReport()
|
||||||
|
// {
|
||||||
|
// //Report type
|
||||||
|
// //same schema as ScheduleStatement
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function scheduleEntitySend()
|
||||||
|
// {
|
||||||
|
// //Entity
|
||||||
|
// //Entity Id
|
||||||
|
// //When
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function projectStatus()
|
||||||
|
// {
|
||||||
|
// //Project ID
|
||||||
|
// //Tasks - task statuses
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user