public function saveQuotation() { $adminId = Session::get('admin_id'); if (!isset($adminId)) { return json_encode(array('message' => 'not logged')); } $requestId = Session::get('current_request_id'); if (!isset($requestId)) { return json_encode(array('message' => 'not logged')); } $patientRequest = PatientRequest::find($requestId); if (isset($patientRequest)) { $quotation = new Quotation(); $quotation->request_id = $requestId; $quotation->kind_attention = Input::get('kind_attention'); $quotation->dated = Input::get('dated'); $quotation->file_number = Input::get('file_number'); $quotation->hospital_reference = Input::get('hospital_reference'); $quotation->patient_age = Input::get('patient_age'); $quotation->sex = Input::get('sex'); $quotation->nationality = Input::get('nationality'); $quotation->medical_speciality = Input::get('medical_speciality'); $quotation->referring_party = Input::get('referring_party'); $quotation->treating_doctor = Input::get('treating_doctor'); $quotation->clinical_summary = Input::get('clinical_summary'); $quotation->clinical_success_rate = Input::get('clinical_success_rate'); $quotation->length_of_stay = Input::get('length_of_stay'); $quotation->pre_evaluation_prescribed = Input::get('pre_evaluation_prescribed'); $quotation->pre_evaluation_cost = Input::get('pre_evaluation_cost'); $quotation->pre_evolution_duration = Input::get('pre_evolution_duration'); $quotation->surgery1_prescribed = Input::get('surgery1_prescribed'); $quotation->surgery1_cost = Input::get('surgery1_cost'); $quotation->surgery1_duration = Input::get('surgery1_duration'); $quotation->surgery2_prescribed = Input::get('surgery2_prescribed'); $quotation->surgery2_cost = Input::get('surgery2_cost'); $quotation->surgery2_duration = Input::get('surgery2_duration'); $quotation->followup_post_discharge_prescribed = Input::get('followup_post_discharge_prescribed'); $quotation->followup_post_discharge_cost = Input::get('followup_post_discharge_cost'); $quotation->followup_post_discharge_duration = Input::get('followup_post_discharge_duration'); $quotation->total_prescribed = Input::get('total_prescribed'); $quotation->total_cost = Input::get('total_cost'); $quotation->total_duration = Input::get('total_duration'); $quotation->status = "active"; $quotation->created_at = date("Y-m-d h:i:s"); $quotation->created_at = date("Y-m-d h:i:s"); $quotation->save(); $patientRequest->status = 'complete'; $patientRequest->updated_at = date('Y-m-d h:i:s'); $patientRequest->save(); return json_encode(array('message' => 'done')); } else { return json_encode(array('message' => 'invalid')); } }
private function saveQuote(Customer $customer) { // Create new or update existing if (\Laravel\Session::get('quote_id')) { $quote = Quotation::find(\Laravel\Session::get('quote_id')); } else { $quote = new Quotation(); $quote->quick_access_code = md5(md5($customer->id) . time() . md5($quote->id)); } $quote->customer_id = $customer->id; $quote->quotation_layouts_id = \Laravel\Session::get('quote_layout_id'); $quote->postcode = \Laravel\Session::get('quote_postcode'); $quote->price = Quotation::calcSessionQuotationCurrentValue(); $quote->quote_customise_swap_window = \Laravel\Session::get('quote_customise_swap_window'); $quote->quote_customise_swap_wall = \Laravel\Session::get('quote_customise_swap_wall'); $quote->quote_customise_extra_door = \Laravel\Session::get('quote_customise_extra_door'); $quote->quote_customise_fanlight = \Laravel\Session::get('quote_customise_fanlight'); $quote->quote_customise_half_window = \Laravel\Session::get('quote_customise_half_window'); $quote->quote_customise_picture_window = \Laravel\Session::get('quote_customise_picture_window'); $quote->quote_decking_composite_deck_910_910 = \Laravel\Session::get('quote_decking_composite_deck_910_910'); $quote->quote_decking_composite_deck_910_1820 = \Laravel\Session::get('quote_decking_composite_deck_910_1820'); $quote->quote_decking_composite_deck_910_2730 = \Laravel\Session::get('quote_decking_composite_deck_910_2730'); $quote->quote_decking_flyover_roof_910_910 = \Laravel\Session::get('quote_decking_flyover_roof_910_910'); $quote->quote_decking_flyover_roof_910_1820 = \Laravel\Session::get('quote_decking_flyover_roof_910_1820'); $quote->quote_decking_flyover_roof_910_2730 = \Laravel\Session::get('quote_decking_flyover_roof_910_2730'); $quote->quote_electrics_double_sockets_450 = \Laravel\Session::get('quote_electrics_double_sockets_450'); $quote->quote_electrics_double_sockets_1150 = \Laravel\Session::get('quote_electrics_double_sockets_1150'); $quote->quote_electrics_light_switch = \Laravel\Session::get('quote_electrics_light_switch'); $quote->quote_electrics_panel_heater = \Laravel\Session::get('quote_electrics_panel_heater'); $quote->quote_electrics_double_floor_socket = \Laravel\Session::get('quote_electrics_double_floor_socket'); $quote->quote_electrics_fused_spur_socket = \Laravel\Session::get('quote_electrics_fused_spur_socket'); $quote->quote_internals_silver_aluminium_venitian_blind_no_screws = \Laravel\Session::get('quote_internals_silver_aluminium_venitian_blind_no_screws'); $quote->quote_internals_recessed_blinds = \Laravel\Session::get('quote_internals_recessed_blinds'); $quote->quote_internals_internal_910_partition_wall = \Laravel\Session::get('quote_internals_internal_910_partition_wall'); $quote->quote_internals_internal_door_dividing_studio = \Laravel\Session::get('quote_internals_internal_door_dividing_studio'); $quote->quote_internals_internal_wall_corner_post = \Laravel\Session::get('quote_internals_internal_wall_corner_post'); $quote->quote_other_decoupled_floor = \Laravel\Session::get('quote_other_decoupled_floor'); $quote->quote_other_aquastep_oak_floor = \Laravel\Session::get('quote_other_aquastep_oak_floor'); $quote->quote_other_walls_to_timber = \Laravel\Session::get('quote_other_walls_to_timber'); $quote->quote_other_taller_walls = \Laravel\Session::get('quote_other_taller_walls'); $quote->quote_other_entry_steps = \Laravel\Session::get('quote_other_entry_steps'); $quote->quote_other_entry_handrail = \Laravel\Session::get('quote_other_entry_handrail'); $quote->quote_other_skirt = \Laravel\Session::get('quote_other_skirt'); $quote->save(); return $quote; }
public function actionCompleteRegistrationAjax() { $client = new Client(); $client->attributes = $_POST['Client']; if ($client->save()) { $quotation = new Quotation(); $quotation->attributes = $_POST['Quotation']; $quotation->client_id = $client->primaryKey; $quotation->creation_date = date("Y-m-d H:i:s"); if ($quotation->save()) { $quot = Quotation::model()->findByPk($quotation->primaryKey); $message = new YiiMailMessage(); $message->view = 'cotizador'; $message->setBody(array("client" => $client, "quotation" => $quot), 'text/html'); $message->setSubject('Prospecto para Cotización'); foreach ($quot->concessioner->emails as $email) { if ($email->type == "QUOTATION") { $message->addTo($email->description); } } // $message->addTo("*****@*****.**"); //$message->addTo("*****@*****.**"); //$message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); $message->setFrom(array(Yii::app()->params['adminEmail'] => 'El Equipo Nissan Ecuador')); Yii::app()->mail->send($message); echo json_encode(true); } else { echo json_encode(false); } } // $vehicle_version= VehicleVersion::model()->findAllByAttributes(array("vehicle_id"=>$_POST['vehicle_id'],"status"=>"ACTIVE")); echo json_encode(true); }