Example #1
0
 public function updateCustomRecord($parameters)
 {
     Project::where('id_090', $parameters['id'])->update(['customer_id_090' => $this->request->input('customerId'), 'customer_name_090' => $this->request->input('customerName'), 'name_090' => $this->request->input('name'), 'description_090' => $this->request->has('description') ? $this->request->input('description') : null, 'estimated_hours_090' => $this->request->has('estimatedHours') ? $this->request->input('estimatedHours') : 0, 'total_hours_090' => (double) $this->request->input('estimatedHours') - (double) $this->request->input('consumedHours'), 'price_090' => $this->request->has('price') ? $this->request->input('price') : null, 'init_date_090' => $this->request->has('initDate') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('initDate'))->getTimestamp() : null, 'init_date_text_090' => $this->request->has('initDate') ? $this->request->input('initDate') : null, 'estimated_end_date_090' => $this->request->has('estimatedEndDate') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('estimatedEndDate'))->getTimestamp() : null, 'estimated_end_date_text_090' => $this->request->has('estimatedEndDate') ? $this->request->input('estimatedEndDate') : null, 'end_date_090' => $this->request->has('endDate') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('endDate'))->getTimestamp() : null, 'end_date_text_090' => $this->request->has('endDate') ? $this->request->input('endDate') : null, 'invoiced_090' => $this->request->has('invoiced')]);
     // start create check and create invoiced
     $project = Project::builder()->find($parameters['id']);
     // create invoiced from project
     if ($this->request->has('endDate') && !$project->invoiced_090) {
         Invoiced::create(['date_094' => date('U'), 'date_text_094' => date(config('pulsar.datePattern')), 'customer_id_094' => $this->request->input('customerId'), 'customer_name_094' => $this->request->input('customerName'), 'type_id_094' => 1, 'project_id_094' => $parameters['id'], 'history_id_094' => null, 'price_094' => $this->request->has('price') ? $this->request->input('price') : 0]);
         Project::where('id_090', $parameters['id'])->update(['invoiced_090' => true]);
     }
 }
Example #2
0
 public function invoiceRecord()
 {
     // get parameters from url route
     $parameters = $this->request->route()->parameters();
     // get billing object
     $billing = Billing::builder()->find($parameters['id']);
     if (empty($billing->price_091)) {
         $price = (double) Preference::getValue('projectsHourPrice', 6)->value_018 * $billing->hours_091;
     } else {
         $price = $billing->price_091;
     }
     $history = History::create(['user_id_093' => $billing->user_id_091, 'user_name_093' => $billing->user_name_091, 'type_id_093' => $billing->type_id_091, 'project_id_093' => null, 'customer_id_093' => $billing->customer_id_091, 'customer_name_093' => $billing->customer_name_091, 'title_093' => $billing->title_091, 'description_093' => $billing->description_091, 'price_093' => $price, 'request_date_093' => $billing->request_date_091, 'request_date_text_093' => $billing->request_date_text_091, 'end_date_093' => $billing->end_date_091, 'end_date_text_093' => $billing->end_date_text_091, 'hours_093' => $billing->hours_091]);
     // create invoiced from todo_
     Invoiced::create(['date_094' => date('U'), 'date_text_094' => date(config('pulsar.datePattern')), 'customer_id_094' => $billing->customer_id_091, 'customer_name_094' => $billing->customer_name_091, 'type_id_094' => $billing->type_id_091, 'project_id_094' => null, 'history_id_094' => $history->id_093, 'price_094' => $price]);
     // destroy billing
     Billing::destroy($billing->id_092);
     // destroy todo_ from user section
     Todo::destroy($billing->todo_id_092);
     return redirect()->route('projectsBilling', ['offset' => $parameters['offset']])->with(['msg' => 1, 'txtMsg' => trans('projects::pulsar.message_successfully_invoiced')]);
 }