thibaultvanc/facturation-regie

This package allows you to manage your facturation

1.0.1 2019-04-15 10:38 UTC

This package is auto-updated.

Last update: 2024-05-15 21:43:10 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Installation

You can install the package via composer:

composer require thibaultvanc/facturation-regie

Usage

1-edit config

To use this package you Need

  • User model
  • Project Model
  • pointables Models (Task & Meeting)
  • Invoice (planified)

Need to associate your Models with traits

User => FacturationRegie\Traits\RegieInvoicable\RegieUser Invoice => FacturationRegie\Traits\RegieInvoicable\RegieInvoice

Pointage => FacturationRegie\Traits\RegieInvoicable\RegiePointage
Project => FacturationRegie\Traits\RegieInvoicable\RegieProject Task/Meeting => FacturationRegie\Traits\RegieInvoicable

exemple =>add RegieInvoicable trait on the table like Task / Meeting / Deplacement

class Task extends Model
{
    use \FacturationRegie\Traits\RegieInvoicable
}

Default forign key to determine the responsable is "responsable_id" Note : overwite the method to set a différent :

public function regie_responsable()
    {
        return $this->belongsTo(\App\User::class, 'user_id');
    }

##trasform a pointable (task / taskStatus / meeting)

#adjust the date

overwrite the getPointageDate() method. Return a Carbon Instance. if this method does not exists, it take the current time

public function getPointageDate() :Carbon
    {
        return $this->done_at
    }

#adjust the name

overwrite the getPointageName() method. Return a Carbon Instance. if this method does not exists, it take the current time

public function getPointageName() :Carbon
    {
        return $this->task_title
    }

#adjust the date

overwrite the getPointageDescription() method. Return a Carbon Instance. if this method does not exists, it take the current time

public function getPointageDescription() :Carbon
    {
        return $this->body
    }

pointage scopes

Pointage::between($date1, $date2); (carbon date or string)

Pointage::forDay($date); (carbon date or carbon)
Pointage::forMonth($date);  (prend le mois en cours)
Pointage::forYeay('2019');  (carbon)
Pointage::forUser($user); (user object or user_id)

Pointage::facturable();
Pointage::noFacturable();

You can combine like this :

    Pointage::forProject($project)
            ->forMonth(now())
            ->forUser($user)
            ->facturable();

Additional

You can scope by project

Pointage::forProject($project);

To do that, you need :

  • on the Project Model add method ... ----------WIP--------