%PDF- %PDF-
Direktori : /var/www/pjc/app/Console/Commands/ |
Current File : /var/www/pjc/app/Console/Commands/Completamento.php |
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use DB; use App\Utility; class Completamento extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'Commesse:completamento'; /** * The console command description. * * @var string */ protected $description = 'Calcolo completamento commesse'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return int */ public function handle() { $commessa=DB::table('project') ->join('projects_accounts', 'projects_accounts.project_id', '=', 'project.id') ->join('project_cstm', 'project_cstm.id_c', '=', 'project.id') ->select('project.id', 'name', 'description', 'estimated_start_date', 'status', 'projects_accounts.account_id', 'project_cstm.importo_c', 'project_cstm.id_c') ->where('project.deleted', 0) ->where('projects_accounts.deleted', 0) ->get(); foreach ($commessa as $item) { $this->info(Utility::percentuale(Utility::totOreDo($item->name), Utility::totOre($item->importo_c, '62.5'))); $this->info(Utility::totOreDo($item->name)); $this->info(Utility::totOre($item->importo_c, '62.5')); DB::table('project_cstm')->where('id_c', $item->id_c) ->update(['completato_c' => Utility::percentuale(Utility::totOreDo($item->name), Utility::totOre($item->importo_c, '62.5'))]); } } }