Пример #1
0
 protected function processServiceStatements($business, $date, $services)
 {
     $changed = false;
     foreach ($services as $serviceSlug => $statements) {
         $service = Service::where('slug', $serviceSlug)->get()->first();
         if ($service === null) {
             continue;
         }
         $vacancy = $business->vacancies()->forDate(Carbon::parse($date))->forService($service);
         if ($vacancy) {
             $vacancy->delete();
         }
         $changed |= $this->processStatements($business, $date, $service, $statements);
     }
     return $changed;
 }
Пример #2
0
 public static function getFirstServiceOfBranch($branch_id)
 {
     return Service::where('branch_id', '=', $branch_id)->first();
 }
Пример #3
0
 protected function processServiceStatements($business, $date, $services)
 {
     $changed = false;
     foreach ($services as $serviceSlug => $statements) {
         $service = Service::where('slug', $serviceSlug)->get()->first();
         if ($service === null) {
             //  Invalid services are skipped to avoid user frustration.
             //  TODO: Still, a user-level WARNING should be raised with no fatal error
             continue;
         }
         $vacancy = $business->vacancies()->forDate(Carbon::parse($date))->forService($service);
         if ($vacancy) {
             $vacancy->delete();
         }
         $changed |= $this->processStatements($business, $date, $service, $statements);
     }
     return $changed;
 }
Пример #4
0
 private function _covenant($society, $blank = "false")
 {
     $pdf = new Fpdf();
     $soc = Society::find($society);
     if (!$blank) {
         $households = Household::with('individual')->where('society_id', '=', $society)->orderBy('sortsurname')->get();
         if ($soc->logo == "") {
             $logopath = base_path() . '/public/images/defaultlogo.jpg';
         } else {
             $logopath = base_path() . '/public/images/defaultlogo.jpg';
         }
     } else {
         $individual = (object) ['firstname' => 'Name:', 'surname' => '', 'memberstatus' => 'member', 'title' => '', 'birthdate' => '', 'cellphone' => '', 'email' => '', 'giving' => '', 'group' => array()];
         $individuals[] = $individual;
         $individuals[] = $individual;
         $individuals[] = $individual;
         $household = (object) ['addressee' => 'Household:', 'addr1' => '', 'addr2' => '', 'addr3' => '', 'post1' => '', 'post2' => '', 'post3' => '', 'homephone' => '', 'householdcell' => '', 'individual' => $individuals];
         $households[] = $household;
     }
     $churchname = $soc->society . " Methodist Church";
     foreach ($households as $household) {
         $pg = 1;
         $pdf->AddPage('P');
         $pdf->SetAutoPageBreak(0, 0);
         $pdf->SetFont('Arial', 'B', 12);
         $pdf->text(10, 10, utf8_decode($household->addressee));
         $pdf->SetFont('Arial', '', 11);
         $pdf->rect(48, 12, 152, 7);
         $pdf->text(10, 17, "Physical Address");
         if ($household->addr1) {
             $addr = $household->addr1;
             if ($household->addr2) {
                 $addr = $addr . ", " . $household->addr2;
                 if ($household->addr3) {
                     $addr = $addr . ", " . $household->addr3;
                 }
             }
             $pdf->text(50, 17, $addr);
         }
         $pdf->rect(48, 21, 152, 7);
         $pdf->text(10, 26, "Postal Address");
         if ($household->addr1) {
             $paddr = $household->post1;
             if ($household->post2) {
                 $paddr = $paddr . ", " . $household->post2;
                 if ($household->post3) {
                     $paddr = $paddr . ", " . $household->post3;
                 }
             }
             $pdf->text(50, 26, $paddr);
         }
         $pdf->text(10, 35, "Home phone");
         $pdf->rect(48, 30, 152, 7);
         $pdf->text(10, 44, "Church SMSes go to");
         $pdf->rect(48, 40, 152, 7);
         $pdf->text(50, 35, substr($household->homephone, 0, 3) . " " . substr($household->homephone, 3, 4) . " " . substr($household->homephone, 7, 3));
         if ($household->householdcell != 0 and Individual::where('id', '=', $household->householdcell)->exists()) {
             $pdf->text(50, 45, Individual::find($household->householdcell)->firstname);
         }
         $yy = 54;
         foreach ($household->individual as $indiv) {
             if ($indiv->memberstatus == "child") {
                 $threshold = 270;
             } else {
                 $threshold = 210;
             }
             if ($yy > $threshold) {
                 $pg++;
                 $pdf->AddPage('P');
                 $pdf->SetFont('Arial', 'B', 11);
                 $pdf->text(10, 10, utf8_decode($household->addressee) . " - page " . $pg);
                 $yy = 18;
                 $pdf->SetFont('Arial', '', 11);
             }
             $starty = $yy;
             $pdf->SetFont('Arial', 'B', 11);
             $pdf->text(10, $yy, $indiv->title . " " . utf8_decode($indiv->firstname) . " " . utf8_decode($indiv->surname));
             $pdf->SetFont('Arial', '', 11);
             $pdf->text(100, $yy, "Date of birth");
             $pdf->rect(123, $yy - 5, 8, 7);
             $pdf->rect(132, $yy - 5, 25, 7);
             $pdf->rect(158, $yy - 5, 20, 7);
             if ($indiv->birthdate != "0000-00-00" and $indiv->birthdate != "") {
                 $pdf->text(125, $yy, date("d", strtotime($indiv->birthdate)));
                 $pdf->text(134, $yy, date("F", strtotime($indiv->birthdate)));
                 if (substr($indiv->birthdate, 0, 4) != "1900" and substr($indiv->birthdate, 0, 4) != "") {
                     $pdf->text(163, $yy, date("Y", strtotime($indiv->birthdate)));
                 } else {
                     $pdf->SetFont('Arial', '', 7);
                     $pdf->setxy(178, $yy - 5.2);
                     $pdf->multicell(23, 2, "Please include year of birth - this is helpful for worship planning");
                 }
             } else {
                 $pdf->SetFont('Arial', '', 7);
                 $pdf->setxy(178, $yy - 5.2);
                 $pdf->multicell(23, 2, "Please include year of birth - this is helpful for worship planning");
             }
             $pdf->SetFont('Arial', '', 11);
             $yy = $yy + 9;
             $pdf->text(10, $yy, "Cellphone");
             $pdf->rect(48, $yy - 5, 50, 7);
             $pdf->text(50, $yy, substr($indiv->cellphone, 0, 3) . " " . substr($indiv->cellphone, 3, 4) . " " . substr($indiv->cellphone, 7, 3));
             $pdf->text(100, $yy, "Email");
             $pdf->rect(111, $yy - 5, 89, 7);
             $pdf->text(113, $yy, $indiv->email);
             $yy = $yy + 9;
             $pdf->text(10, $yy, "I would like to be considered as a: ");
             $pdf->rect(72, $yy - 4, 6, 6);
             $pdf->text(80, $yy, "member");
             $pdf->rect(102, $yy - 4, 6, 6);
             $pdf->text(110, $yy, "non-member");
             $pdf->rect(138, $yy - 4, 6, 6);
             $pdf->text(146, $yy, "child");
             if ($indiv->memberstatus == "child") {
                 $pdf->text(140, $yy, "X");
             }
             $pdf->rect(162, $yy - 4, 6, 6);
             $pdf->text(170, $yy, "youth");
             if ($indiv->memberstatus == "youth") {
                 $pdf->text(164, $yy, "X");
             }
             $yy = $yy + 3;
             if (strtolower($indiv->memberstatus) != "child") {
                 $adultgroups = array();
                 $pdf->rect(10, $yy, 38, 45);
                 $pdf->image(base_path() . '/public/images/serve.png', 32, $yy + 30, 14, 14);
                 $pdf->rect(48, $yy, 38, 45);
                 $pdf->image(base_path() . '/public/images/worship.png', 70, $yy + 30, 14, 14);
                 $pdf->rect(86, $yy, 38, 45);
                 $pdf->image(base_path() . '/public/images/learn.png', 108, $yy + 30, 14, 14);
                 $pdf->rect(124, $yy, 38, 45);
                 $pdf->image(base_path() . '/public/images/give.png', 147, $yy + 30, 14, 14);
                 $pdf->rect(162, $yy, 38, 45);
                 $pdf->image(base_path() . '/public/images/connect.png', 184, $yy + 30, 14, 14);
                 $adultgroups['service'] = "";
                 $adultgroups['course'] = "";
                 $adultgroups['fellowship'] = "";
                 $adultgroups['worship'] = "";
                 $pdf->SetFont('Arial', '', 8);
                 // Giving
                 $pdf->setxy(124, $yy);
                 if ($indiv->giving == 0) {
                     $pdf->multicell(38, 4, "I do not have a planned giving number.");
                     $pdf->rect(125, $yy + 9, 5, 5);
                     $pdf->text(132, $yy + 12, "Please send me info");
                     $pdf->rect(125, $yy + 15, 5, 5);
                     $pdf->text(132, $yy + 18, "Please sign me up");
                 } else {
                     $pdf->multicell(38, 4, "I am a planned giver and have a PG number.");
                     $pdf->rect(125, $yy + 9, 5, 5);
                     $pdf->text(132, $yy + 12, "But I can't remember it!");
                     $pdf->rect(125, $yy + 15, 5, 5);
                     $pdf->setxy(131, $yy + 16);
                     $pdf->multicell(30, 4, "I have not been receiving a quarterly acknowledgement of my planned giving offerings");
                 }
                 foreach ($indiv->group as $group) {
                     if ($group->grouptype != "admin") {
                         $adultgroups[$group->grouptype] = $adultgroups[$group->grouptype] . $group->groupname . ", ";
                     }
                 }
                 //Service
                 $pdf->setxy(10, $yy);
                 $pdf->SetFont('Arial', 'B', 8);
                 if ($adultgroups['service']) {
                     $pdf->multicell(38, 3, "Current: " . substr($adultgroups['service'], 0, strlen($adultgroups['service']) - 2));
                 }
                 $pdf->SetFont('Arial', '', 8);
                 $pdf->setxy(10, $pdf->gety());
                 $pdf->multicell(38, 3, "I'm interested in getting involved in: ");
                 // Worship
                 $pdf->setxy(48, $yy);
                 $services = Service::where('society_id', '=', $soc->id)->get();
                 if (count($services) > 1) {
                     $pdf->multicell(38, 4, "The service I usually attend is:");
                     $yadd = 0;
                     foreach ($services as $service) {
                         $pdf->rect(60, $yy + 9 + $yadd, 5, 5);
                         $pdf->text(67, $yy + 12 + $yadd, $service->servicetime);
                         $yadd = $yadd + 7;
                     }
                 } else {
                     $pdf->text(58, $yy + 6, $services[0]->servicetime . " service");
                 }
                 // Courses
                 $pdf->setxy(86, $yy);
                 $courses = Group::where('society_id', '=', $soc->id)->where('groupname', 'like', date('Y') . "%")->where('grouptype', '=', 'course')->get();
                 if (count($courses)) {
                     $pdf->multicell(38, 4, "I am interested in doing a course this year:");
                     $yadd = 0;
                     foreach ($courses as $course) {
                         $pdf->rect(87, $yy + 9 + $yadd, 5, 5);
                         $pdf->text(93, $yy + 12 + $yadd, substr($course->groupname, 4));
                         $yadd = $yadd + 7;
                     }
                 } else {
                     $pdf->multicell(38, 4, "I would love to do a course this year. I am interested in:");
                 }
                 //Groups
                 $pdf->setxy(162, $yy);
                 if ($adultgroups['fellowship']) {
                     $pdf->SetFont('Arial', 'B', 8);
                     $pdf->multicell(38, 4, "Current group: " . substr($adultgroups['fellowship'], 0, -2));
                     $pdf->SetFont('Arial', '', 8);
                 } else {
                     $groups = Group::where('society_id', '=', $soc->id)->where('groupname', 'like', date('Y') . "%")->where('grouptype', '=', 'fellowship')->get();
                     if (count($groups)) {
                         $pdf->multicell(38, 4, "I would like to join a small group:");
                         $yadd = 0;
                         foreach ($groups as $group) {
                             $pdf->rect(163, $yy + 9 + $yadd, 5, 5);
                             $pdf->text(169, $yy + 12 + $yadd, substr($group->groupname, 4));
                             $yadd = $yadd + 7;
                         }
                     } else {
                         $pdf->multicell(38, 4, "I would like to join a small group - please send more info.");
                     }
                 }
                 $yy = $yy + 3;
                 $yy = $yy + 48;
                 $pdf->rect(9, $starty - 6, 192, $yy - $starty + 1);
             } else {
                 $allgroups = "";
                 foreach ($indiv->group as $group) {
                     $allgroups = $allgroups . $group->groupname . ", ";
                 }
                 $pdf->SetFont('Arial', '', 8);
                 $pdf->text(10, $yy + 2, substr($allgroups, 0, -2));
                 $yy = $yy + 6;
                 $pdf->rect(9, $starty - 6, 192, $yy - $starty + 3);
                 $yy = $yy + 2;
             }
             $yy = $yy + 2;
         }
     }
     $pdf->Output();
     exit;
 }
Пример #5
0
 public function index()
 {
     return view('home.index', ['services' => Service::where('on_the_home', 1)->orderBy('weight')->get(), 'portfolios' => Portfolio::where('on_the_home', 1)->orderBy('weight')->get()]);
 }
Пример #6
0
 public static function createBusinessNewTerminal($business_id, $name)
 {
     $first_branch = Branch::where('business_id', '=', $business_id)->first();
     $first_service = Service::where('branch_id', '=', $first_branch->branch_id)->first();
     $terminal = new Terminal();
     $terminal->name = $name;
     $terminal->service_id = $first_service->service_id;
     $terminal->status = 1;
     $terminal->box_rank = Terminal::generateBoxRank($first_service->service_id);
     // Added by PAG
     $terminal->save();
 }