<?php $form->widget('zii.widgets.jui.CJuiDatePicker', array('name' => CHtml::activeName($workcarriedoutmodel, 'job_completion_date'), 'model' => $workcarriedoutmodel, 'value' => $workcarriedoutmodel->job_completion_date, 'options' => array('showAnim' => 'fadeIn', 'dateFormat' => 'dd-M-yy'), 'htmlOptions' => array('style' => 'height:20px;', 'readonly' => 'true', 'tabindex' => '9'))); ?> <?php echo $form->error($workcarriedoutmodel, 'job_completion_date'); ?> </td> <td> <div class="data_box"> <label>Payment Date</label> <h6><?php echo Servicecalls::model()->findpaymentdate($model->communications); ?> </h6> </div> </td> </tr> </table> <div class="row compactRadioGroup"> <?php echo $form->labelEx($workcarriedoutmodel, 'spares_used'); ?>
public function actionSendstatusupdatetoamica() { $json_array = array(); $json_array['status'] = 'BAD_REQUEST'; $json_array['status_message'] = 'This is bad request'; $email = ""; $pwd = ""; if (isset($_POST['email'])) { $email = $_POST['email']; } if (isset($_POST['pwd'])) { $pwd = $_POST['pwd']; } $verify_engg = Systemconfig::model()->verifyengg($email, $pwd); $json_array['status_message'] .= "<br> verifyengg" . $verify_engg; if ($verify_engg) { $json_array['status'] = 'LOGIN_OK'; $json_array['status_message'] = 'You have been successfully logged in.'; $service_ref_no = $_POST['remote_ref_no']; $status_log = $_POST['status_log']; $api_key = $_POST['api_key']; $service_id = Servicecalls::model()->getserviceidbyservicerefrencenumber($service_ref_no); $json_array['status_message'] .= "<br> service_id" . $service_id; if ($service_id) { } $json_array['status'] = 'SERVICECALL_OK'; $json_array['status_message'] = 'Service call is found.'; $model = $this->loadModel($service_id); $model->status_log = $status_log; if ($model->save()) { $data_type = 'status_log'; //////send to Razzmatazz Server $return_data_array = array(); $return_data_array['type'] = $data_type; ///is it a message or servicecall_data $return_data_array['engineer_email'] = $email; $return_data_array['service_reference_number'] = $model->service_reference_number; $return_data_array['gomobile_account_id'] = $api_key; $return_data_array['sent_data'] = array('data_sent' => $model->data_sent, 'communications' => $model->communications, 'status_log' => $model->status_log); $data_to_be_sent_string = json_encode(array('data' => $return_data_array)); $url = "index.php?r=server/getdatafromportal"; $method = 'POST'; $data_to_be_sent_string = urlencode($data_to_be_sent_string); $data = "engineer_email=" . $email . "&pwd=" . $pwd . "&data=" . $data_to_be_sent_string; $result = Systemconfig::model()->callurl($url, $data, $method); $json_array['status_message'] .= "Sending result-" . $result; } /////end of if ($model->save()) ///end of if($service_id); } ////end of if ($verify_engg) echo json_encode($json_array); }
public function insertservicecall($service) { $model = new Servicecalls(); $model->service_reference_number = $service->service_reference_number; $model->engineer_email = $service->engineer_email; $model->engineer_user_id = $this->getuseridofengineerbyengineeremail($service->engineer_email); $model->callcenter_account_id = $service->gomobile_account_id; $model->customer_fullname = $service->customer_fullname; $model->customer_address = $service->customer_address; $model->customer_postcode = $service->customer_postcode; $model->data_recieved = json_encode($service->data); $model->jobstatus_id = 1; ///for new job ///communications needs to be initialised here //echo json_encode($service->allchatmessage); $chatarray['chats'] = array(); $amica_chat_array = array(); $amica_chat_array['date'] = $service->allchatmessage->chats->date; $amica_chat_array['person'] = $service->allchatmessage->chats->person; $amica_chat_array['message'] = $service->allchatmessage->chats->message; array_push($chatarray['chats'], $amica_chat_array); $model->communications = json_encode($chatarray); if ($model->save()) { return 'Successfully saved'; } else { return 'Error in saving Please call support'; } }