Esempio n. 1
0
 /**
  * Cost Vs Selling Price Report
  *
  * @return $this
  */
 public function costVsSelling($month, $year)
 {
     $this->authorize('view_gp_report');
     $date = Carbon::create($year, $month);
     $jobIds = DespatchLogEntry::thisMonth($date)->get()->pluck('despatch_log_book_job_cards_id_fk')->toArray();
     return view('reports.costVsSelling')->with(['jobs' => JobCard::find($jobIds)]);
 }
 /**
  * Returns a random active job
  *
  * @return mixed
  */
 protected function getRandomJob($department = null)
 {
     $jobs = \App\Models\JobCard::active()->lists('job_cards_id')->toArray();
     if ($department == 'printing') {
         $jobs = \App\Models\JobCard::active()->printingCurrentTen()->lists('job_cards_id')->toArray();
     }
     $randomJob = \App\Models\JobCard::find($this->fake->randomElements($jobs))[0];
     return $randomJob;
 }
 /**
  * @test
  */
 public function scope_for_sheets_associated_with_given_job()
 {
     $job = JobCard::find(1);
     $job_log_sheets = PrintingLogSheet::associatedWithJob($job)->get();
     $associated_log_sheets_manually = DB::table('printing_log_sheets')->where('job_id_fk', $job->job_cards_id)->get();
     foreach ($job_log_sheets as $sheet) {
         $this->assertEquals($sheet->job_id_fk, $job->job_cards_id);
     }
     $this->assertCount(count($associated_log_sheets_manually), $job_log_sheets);
 }
 /**
  * @test
  */
 public function job_card_times()
 {
     $job = JobCard::find(4541);
     $calculator = new QtyTimeRequiredCalculator($job);
     $this->assertInstanceOf(JobCosting::class, $calculator->job_costing, "Job Costing Type");
     $this->assertInternalType('double', $calculator->production_quantity, "production_quantity");
     $this->assertInternalType('int', $calculator->printing_hours, "printing_hours type");
     $this->assertInternalType('int', $calculator->laminating_hours, "laminating_hours type");
     $this->assertInternalType('int', $calculator->slitting_hours, "production_quantity type");
     $this->assertInternalType('int', $calculator->lead_time, "production_quantity type");
 }
Esempio n. 5
0
 private function getRandomActiveJob()
 {
     $this->jobs = App\Models\JobCard::active()->lists('job_cards_id')->toArray();
     return App\Models\JobCard::find($this->fake->randomElements($this->jobs))[0];
 }
Esempio n. 6
0
 /**
  * @test
  */
 public function requiredMaterial()
 {
     $job = JobCard::find(4307);
     $this->assertInstanceOf(JobCard::class, $job, "Job Card Model");
     $costing = $job->jobCosting;
     $this->assertInstanceOf(JobCosting::class, $costing, "Job Costing Model");
     $requiredMat1 = $job->requiredMaterialLayer(1);
     $requiredMat2 = $job->requiredMaterialLayer(2);
     $requiredMat3 = $job->requiredMaterialLayer(3);
     $mat1Width = $job->materialWidthLayer(1);
     $mat2Width = $job->materialWidthLayer(2);
     $requiredMat1Calc = $job->required_print_meters * $job->materialLayer(1)->gramsPerMeter($mat1Width) / 1000;
     $requiredMat2Calc = $job->required_production_meters * $job->materialLayer(2)->gramsPerMeter($mat2Width) / 1000;
     $this->assertEquals($requiredMat1Calc, $requiredMat1, "Required Material 1");
     $this->assertEquals($requiredMat2Calc, $requiredMat2, "Required Material 2");
     $this->assertEquals(0, $requiredMat3, "Required Material 3");
 }
Esempio n. 7
0
 /**
  * Collection of jobs started in this department in current shift
  * @return Collection
  */
 public function currentShiftJobsStarted()
 {
     $jobsStartedIds = DB::table(PrintingLogSheet::table())->select('job_id_fk')->groupBy('job_id_fk')->havingRaw('min(created_at) >= \'' . $this->current_shift->starting_time . '\'')->havingRaw('min(created_at) <= \'' . $this->current_shift->ending_time . '\'')->pluck('job_id_fk');
     return JobCard::find($jobsStartedIds);
 }