Esempio n. 1
1
			<h1>Danh bạ khách sạn</h1>
		</div><!--/.page-header-->
		<div class="row-fluid">
			<div class="span12">
				<a href="<?php 
echo PIUrl::createUrl('/admin/hotel/create/');
?>
" class="btn btn-primary">
					<i class="icon-ok bigger-110"></i>
					<?php 
echo translate('Thêm');
?>
				</a>
				<form method="post">
					<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'hotel-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'htmlOptions' => array(), 'itemsCssClass' => 'table table-striped table-bordered table-hover', 'emptyText' => 'Không có kết quả hiển thị', 'selectableRows' => 2, 'summaryText' => 'Hiển thị {start} - {end} của {count} kết quả ', 'columns' => array(array('id' => 'id', 'class' => 'CCheckBoxColumn'), array('header' => 'STT', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), 'image' => array('name' => 'image', 'type' => 'raw', 'filter' => false, 'value' => 'CHtml::image(getImage($data->image,"80", "60" ))', 'htmlOptions' => array("class" => "image")), 'name', 'type' => array('name' => 'type', 'type' => 'raw', 'filter' => CHtml::dropDownList('Hotel[type]', '', Hotel::model()->getTypeHotel()), 'value' => 'Hotel::model()->getType($data->type)'), 'pro.title' => array('name' => 'provinces', 'type' => 'raw', 'value' => 'isset($data->pro->title) ? $data->pro->title :  ""', 'filter' => CHtml::dropDownList('Hotel[provinces]', '', Provinces::model()->getData())), 'ward.title' => array('name' => 'wards', 'type' => 'raw', 'value' => 'isset($data->ward->title) ? $data->ward->title :  ""', 'filter' => CHtml::dropDownList('Hotel[wards]', '', Wards::model()->getData())), 'address' => array('name' => 'address', 'type' => 'raw', 'value' => '$data->address', 'filter' => false), array('header' => '<input type="button" name="deleteAll" class="deleteAll btn btn-mini btn-danger icon-trash bigger-120" value="Xóa" />', 'class' => 'CButtonColumn', 'template' => '{update}{delete}', 'buttons' => array('update' => array('options' => array('class' => 'btn btn-mini btn-info icon-edit bigger-120', 'title' => 'Sửa tin tức'), 'imageUrl' => false, 'label' => false), 'delete' => array('label' => false, 'options' => array('class' => 'btn btn-mini btn-danger icon-trash bigger-120', 'title' => 'Xóa tin tức'), 'imageUrl' => false)), 'deleteConfirmation' => 'Bạn có muốn xóa tin tức này không?'))));
?>
			</form>	
			</div><!--/.span-->
		</div><!--/.row-fluid-->
	</div><!--/.page-content-->
</div><!--/.main-content-->
<style>
.grid-view .filters input, .grid-view .filters select {
    width: 92%;
}
.image img{
	width:80px;
	height:60px;
}
.btn-info{margin-right:3px;}
Esempio n. 2
0
 public function isValid($value, $context = null)
 {
     $value = intval($value);
     if ($value != 0) {
         $countryid = intval($context['country_id']);
         if ($countryid == 0) {
             $this->_error(self::COUNTRYIDEMPTY);
             return false;
         }
         $region_id = intval($context['region_id']);
         if ($countryid == 0) {
             $this->_error(self::REGIONIDEMPTY);
             return false;
         }
         $province = Provinces::find($value);
         if ($province->country_id != $countryid) {
             $this->_error(self::PROVINCEIDNOTVALID);
             return false;
         }
         if ($province->region_id != $region_id) {
             $this->_error(self::PROVINCEIDNOTVALID);
             return false;
         }
     }
     return true;
 }
 public function loadModel($id)
 {
     $model = Provinces::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 4
0
 public function getProvince($id)
 {
     $province = Provinces::where('country_id', '=', $id)->get();
     $html = '<option></option>';
     foreach ($province as $p) {
         $html .= "<option value='" . $p->id . "'>" . $p->name . "</option>";
     }
     echo $html;
 }
Esempio n. 5
0
 public function getData()
 {
     $data = Provinces::model()->findALl();
     $result = array();
     $result[''] = '-- chọn tỉnh/thành phố --';
     foreach ($data as $dt) {
         $result[$dt->id] = $dt->title;
     }
     return $result;
 }
Esempio n. 6
0
 public function getIndex()
 {
     $hotel = Hotel::find(1);
     $regions = Regions::all();
     $country = Countries::where('region_id', '=', $hotel->city->province->country->region->id)->get();
     $province = Provinces::where('country_id', '=', $hotel->city->province->country->id)->get();
     $city = Cities::where('province_id', '=', $hotel->city->province->id)->get();
     $options = array('hotel' => $hotel, 'regions' => $regions, 'country' => $country, 'province' => $province, 'city' => $city);
     return View::make('home/dashboard', array())->nest('content', 'hotel/profile', $options);
 }
Esempio n. 7
0
 public function getAll($regionid)
 {
     $this->authenticate();
     if (empty($regionid)) {
         throw new Shineisp_Api_Exceptions(400002, ":: 'regionid' field");
         exit;
     }
     $provinces = Provinces::findAllByRegionID($regionid);
     if (empty($provinces)) {
         return false;
     }
     return $provinces;
 }
Esempio n. 8
0
 public function actionUpdate($id = null)
 {
     $model = Wards::model()->findByPk($id);
     if (!empty($_POST['Wards'])) {
         $model->attributes = $_POST['Wards'];
         $model->province_id = $_POST['Wards']['province_id'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/Wards/'));
         }
     }
     $dataProvinces = Provinces::model()->getData();
     $this->render('update', array('model' => $model, 'dataProvinces' => $dataProvinces));
 }
Esempio n. 9
0
 /**
  * indexAction
  * Create the User object and get all the records.
  * @return unknown_type
  */
 public function getallAction()
 {
     $result = array();
     $result['success'] = false;
     $id = $this->getRequest()->getParam('region_id');
     $id = intval($id);
     if ($id == 0) {
         $result['message'] = 'RegionID not found';
         echo json_encode($result);
         exit;
     }
     $result['success'] = true;
     $provinces = Provinces::findAllByRegionID($id);
     $result['total'] = count($provinces);
     if ($result['total'] > 0) {
         array_unshift($provinces, array('province_id' => 0, 'name' => '-- Select Provinces --', 'code' => ''));
     }
     $result['rows'] = $provinces;
     echo json_encode($result);
     exit;
 }
Esempio n. 10
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     if (Auth::check()) {
         $currentPage = "EVENTS";
         $mainMenu = "EVENTS_MAIN";
         $inputs = Input::all();
         if (isset($inputs['eventName'])) {
             $eventsAddResult = Events::addEvent($inputs);
             if ($eventsAddResult) {
                 Session::flash('msg', "Event added successfully.");
                 return Redirect::to('events');
             }
         }
         $provinces = Provinces::getProvinces("IN");
         $eventTypes = EventTypes::getAllEventTypes();
         $events = Events::getAllEvents();
         $dataToView = array('currentPage', 'mainMenu', 'events', 'provinces', 'eventTypes');
         return View::make('pages.events.events', compact($dataToView));
     } else {
         return Redirect::to("/");
     }
 }
Esempio n. 11
0
 public function edit_district($code)
 {
     $district = Districts::getDistrict($code);
     $data['district_populations'] = District_Populations::getAllForDistrict($code);
     $data['district'] = $district;
     $data['title'] = "District Management::Edit " . $district->name . " District";
     $data['module_view'] = "add_district_view";
     $data['quick_link'] = "new_district";
     $data['provinces'] = Provinces::getAllProvinces();
     $this->base_params($data);
 }
Esempio n. 12
0
 public function printReport($from, $to)
 {
     @$this->load->database();
     @($user_groups = User_groups::getAllGroups());
     foreach ($user_groups as $user_group) {
         @($identifier = $user_group["Identifier"]);
         @($population = 0);
         @($opening_balance = 0);
         @($closing_balance = 0);
         @($sql_consumption = "");
         @($store = "");
         @($vaccines = Vaccines::getAll_Minified());
         if ($identifier == 'provincial_officer') {
             @($provinces = Provinces::getAllProvinces());
             foreach ($provinces as $province) {
                 @($data_buffer = "\n\t\t\t   <style>\n\t\t\ttable.data-table {\n\t\t\ttable-layout: fixed;\n\t\t\twidth: 700px;\n\t\t\tborder-collapse:collapse;\n\t\t\tborder:1px solid black;\n\t\t\t}\n\t\t\ttable.data-table td, th {\n\t\t\twidth: 100px;\n\t\t\tborder: 1px solid black;\n\t\t\t}\n\t\t\t.leftie{\n\t\t\t\ttext-align: left !important;\n\t\t\t}\n\t\t\t.right{\n\t\t\t\ttext-align: right !important;\n\t\t\t}\n\t\t\t.center{\n\t\t\t\ttext-align: center !important;\n\t\t\t}\n\t\t\t</style>\n\t\t\t  ");
                 @($start_date = $from);
                 @($end_date = $to);
                 @($data_buffer .= "<table class='data-table'>");
                 @($data_buffer .= $this->echoTitles());
                 foreach ($vaccines as $vaccine) {
                     @($district_or_region = $province["id"]);
                     @($region_object = Regions::getRegion($district_or_region));
                     @($store = $region_object->name);
                     @($population = Regional_Populations::getRegionalPopulation($district_or_region, date('Y')));
                     @($opening_balance = Disbursements::getRegionalPeriodBalance($district_or_region, $vaccine->id, strtotime($start_date)));
                     @($closing_balance = Disbursements::getRegionalPeriodBalance($district_or_region, $vaccine->id, strtotime($end_date)));
                     @($owner = "R" . $district_or_region);
                     @($sql_consumption = "select (SELECT max(str_to_date(Date_Issued,'%m/%d/%Y'))  FROM `disbursements` where Owner = '" . $owner . "' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "' and total_stock_balance>0)as last_stock_count,(SELECT sum(Quantity)FROM `disbursements` where Issued_By_Region = '" . $district_or_region . "' and Owner = '" . $owner . "' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and\n  str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "')as total_issued,(SELECT sum(Quantity) FROM `disbursements` where Issued_To_Region = '" . $district_or_region . "' and Owner = '" . $owner . "' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and\n  str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "')as total_received");
                     @($query = $this->db->query($sql_consumption));
                     @($vaccine_data = $query->row());
                     @($monthly_requirement = ceil($vaccine->Doses_Required * $population * $vaccine->Wastage_Factor / 12));
                     @($data_buffer .= "<tr><td>" . $vaccine->Name . "</td><td>" . number_format($opening_balance + 0) . "</td><td>" . number_format($vaccine_data->total_received + 0) . "</td><td>" . number_format($vaccine_data->total_issued + 0) . "</td><td>" . number_format($closing_balance - ($opening_balance + $vaccine_data->total_received - $vaccine_data->total_issued) + 0) . "</td><td>" . number_format($closing_balance + 0) . "</td><td>" . number_format($closing_balance / $monthly_requirement, 1) . "</td><td>" . $vaccine_data->last_stock_count . "</td></tr>");
                 }
                 //end of foreach vaccines
                 @($vals = 1);
                 @($data_buffer .= "</table>");
                 @$this->generatePDF($data_buffer, $start_date, $end_date, $store, $district_or_region, $vals, $store);
                 @($data_buffer = "");
             }
         }
         if ($identifier == 'district_officer') {
             @($districts = Districts::getAllDistricts());
             foreach ($districts as $district) {
                 @($data_buffer = "\n\t\t\t    <style>\n\t\t\ttable.data-table {\n\t\t\ttable-layout: fixed;\n\t\t\twidth: 700px;\n\t\t\tborder-collapse:collapse;\n\t\t\tborder:1px solid black;\n\t\t\t}\n\t\t\ttable.data-table td, th {\n\t\t\twidth: 100px;\n\t\t\tborder: 1px solid black;\n\t\t\t}\n\t\t\t.leftie{\n\t\t\t\ttext-align: left !important;\n\t\t\t}\n\t\t\t.right{\n\t\t\t\ttext-align: right !important;\n\t\t\t}\n\t\t\t.center{\n\t\t\t\ttext-align: center !important;\n\t\t\t}\n\t\t\t</style>\n\t\t\t  ");
                 @($start_date = $from);
                 @($end_date = $to);
                 @($data_buffer .= "<table class='data-table'>");
                 @($data_buffer .= $this->echoTitles());
                 foreach ($vaccines as $vaccine) {
                     @($district_or_region = $district["id"]);
                     @($district_object = Districts::getDistrict($district_or_region));
                     @($store = $district_object->name);
                     @($population = District_Populations::getDistrictPopulation($district_or_region, date('Y')));
                     @($opening_balance = Disbursements::getDistrictPeriodBalance($district_or_region, $vaccine->id, strtotime($start_date)));
                     @($closing_balance = Disbursements::getDistrictPeriodBalance($district_or_region, $vaccine->id, strtotime($end_date)));
                     @($owner = "D" . $district_or_region);
                     @($sql_consumption = "select (SELECT max(str_to_date(Date_Issued,'%m/%d/%Y'))  FROM `disbursements` where Owner = '" . $owner . "' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "' and total_stock_balance>0)as last_stock_count,(SELECT sum(Quantity)FROM `disbursements` where Issued_By_District = '" . $district_or_region . "' and Owner = '" . $owner . "' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and\n  str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "')as total_issued,(SELECT sum(Quantity) FROM `disbursements` where Issued_To_District = '" . $district_or_region . "' and Owner = '" . $owner . "' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and\n  str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "')as total_received");
                     @($query = $this->db->query($sql_consumption));
                     @($vaccine_data = $query->row());
                     @($monthly_requirement = ceil($vaccine->Doses_Required * $population * $vaccine->Wastage_Factor / 12));
                     @($data_buffer .= "<tr><td>" . $vaccine->Name . "</td><td>" . number_format($opening_balance + 0) . "</td><td>" . number_format($vaccine_data->total_received + 0) . "</td><td>" . number_format($vaccine_data->total_issued + 0) . "</td><td>" . number_format($closing_balance - ($opening_balance + $vaccine_data->total_received - $vaccine_data->total_issued) + 0) . "</td><td>" . number_format($closing_balance + 0) . "</td><td>" . number_format($closing_balance / $monthly_requirement, 1) . "</td><td>" . $vaccine_data->last_stock_count . "</td></tr>");
                 }
                 //end of foreach vaccines
                 @($vals = 2);
                 @($data_buffer .= "</table>");
                 @$this->generatePDF($data_buffer, $start_date, $end_date, $store, $district_or_region, $vals, $store);
                 @($data_buffer = "");
             }
         }
         if ($identifier == 'national_officer') {
             @($data_buffer = "\n\t\t\t    <style>\n\t\t\ttable.data-table {\n\t\t\ttable-layout: fixed;\n\t\t\twidth: 700px;\n\t\t\tborder-collapse:collapse;\n\t\t\tborder:1px solid black;\n\t\t\t}\n\t\t\ttable.data-table td, th {\n\t\t\twidth: 100px;\n\t\t\tborder: 1px solid black;\n\t\t\t}\n\t\t\t.leftie{\n\t\t\t\ttext-align: left !important;\n\t\t\t}\n\t\t\t.right{\n\t\t\t\ttext-align: right !important;\n\t\t\t}\n\t\t\t.center{\n\t\t\t\ttext-align: center !important;\n\t\t\t}\n\t\t\t</style>\n\t\t\t  ");
             @($start_date = $from);
             @($end_date = $to);
             @($data_buffer .= "<table class='data-table'>");
             @($data_buffer .= $this->echoTitles());
             @($store = "Central Vaccines Store");
             foreach ($vaccines as $vaccine) {
                 @($population = Regional_Populations::getNationalPopulation(date('Y')));
                 @($opening_balance = Disbursements::getNationalPeriodBalance($vaccine->id, strtotime($start_date)));
                 @($closing_balance = Disbursements::getNationalPeriodBalance($vaccine->id, strtotime($end_date)));
                 @($sql_consumption = "select (SELECT max(str_to_date(Date_Issued,'%m/%d/%Y'))  FROM `disbursements` where Owner = 'N0' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "' and total_stock_balance>0)as last_stock_count,(SELECT sum(Quantity)FROM `disbursements` where Issued_By_National = '0' and Owner = 'N0' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and\n  str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "')as total_issued,(SELECT sum(Quantity) FROM `disbursements` where Issued_To_National = '0' and Owner = 'N0' and str_to_date(Date_Issued,'%m/%d/%Y') between str_to_date('" . $start_date . "','%m/%d/%Y') and\n  str_to_date('" . $end_date . "','%m/%d/%Y') and Vaccine_Id = '" . $vaccine->id . "')as total_received");
                 @($query = $this->db->query($sql_consumption));
                 @($vaccine_data = $query->row());
                 @($monthly_requirement = ceil($vaccine->Doses_Required * $population * $vaccine->Wastage_Factor / 12));
                 @($data_buffer .= "<tr><td>" . $vaccine->Name . "</td><td>" . number_format($opening_balance + 0) . "</td><td>" . number_format($vaccine_data->total_received + 0) . "</td><td>" . number_format($vaccine_data->total_issued + 0) . "</td><td>" . number_format($closing_balance - ($opening_balance + $vaccine_data->total_received - $vaccine_data->total_issued) + 0) . "</td><td>" . number_format($closing_balance + 0) . "</td><td>" . number_format($closing_balance / $monthly_requirement, 1) . "</td><td>" . $vaccine_data->last_stock_count . "</td></tr>");
             }
             //end of foreach vaccines
             @($vals = 3);
             @($data_buffer .= "</table>");
             @($district_or_region = "");
             @$this->generatePDF($data_buffer, $start_date, $end_date, $store, $district_or_region, $vals, $store);
             @($data_buffer = "");
         }
     }
     //end of foreach user_group
 }
 /**
  * Update the record previously selected
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/domainsprofiles/process");
     $request = $this->getRequest();
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domainsprofiles/list", "label" => $this->translator->translate('List'), "params" => array('css' => null)), array("url" => "/admin/domainsprofiles/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     try {
         // Check if we have a POST request
         if (!$request->isPost()) {
             return $this->_helper->redirector('list', 'domainsprofiles', 'admin');
         }
         if ($form->isValid($request->getPost())) {
             $params = $request->getPost();
             $area = intval($params['area']);
             if ($area != 0) {
                 $province = Provinces::find($area);
                 $area = $province->code;
                 $params['area'] = $area;
             }
             $id = DomainsProfiles::saveAll($params, $request->getParam('profile_id'));
             $this->_helper->redirector('edit', 'domainsprofiles', 'admin', array('id' => $id, 'mex' => $this->translator->translate('The task requested has been executed successfully.'), 'status' => 'success'));
         } else {
             $this->view->form = $form;
             $this->view->title = $this->translator->translate("Domain Profile details");
             $this->view->description = $this->translator->translate("Here you can edit the domains profile details.");
             return $this->render('applicantform');
         }
     } catch (Exception $e) {
         $this->_helper->redirector('edit', 'domainsprofiles', 'admin', array('id' => $id, 'mex' => $e->getMessage(), 'status' => 'danger'));
     }
 }
Esempio n. 14
0
 public function actionUpdate($id = null)
 {
     $model = Hotel::model()->findByPk($id);
     $flag = 0;
     $image_old = $model->attributes['image'];
     if (!empty($_POST['Hotel'])) {
         if (!empty(CUploadedFile::getInstance($model, 'image')->name)) {
             $image_old = $model->attributes['image'];
             $path = realpath(Yii::app()->basePath . '/../upload/images/' . $image_old);
             if (file_exists($path) && !empty($image_old)) {
                 unlink($path);
             }
             $model->attributes = $_POST['Hotel'];
             $model->image = CUploadedFile::getInstance($model, 'image');
             $image = $model->image;
             $imageType = explode('.', $model->image->name);
             $imageType = $imageType[count($imageType) - 1];
             $imageName = md5(uniqid()) . '.' . $imageType;
             $model->image = $imageName;
             $images_path = Yii::getPathOfAlias('webroot') . '/upload/images/' . $imageName;
             $flag = 1;
         } else {
             $model->attributes = $_POST['Hotel'];
             $model->image = $image_old;
         }
         $model->provinces = $_POST['provinces'];
         $model->wards = $_POST['wards'];
         $model->created = time();
         $model->alias = alias($_POST['Hotel']['name']);
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập khách sạn thành công.'));
             if ($flag == 1) {
                 $image->saveAs($images_path);
             }
             $this->redirect(PIUrl::createUrl('/admin/hotel/'));
         }
     }
     $criteria = new CDBCriteria();
     $criteria->select = "id, title";
     $provinces = Provinces::model()->findAll($criteria);
     $ward = new Wards();
     $wards = $ward->getWards($model->provinces);
     $typeHotel = Hotel::model()->getTypeHotel();
     $this->render('update', array('model' => $model, 'provinces' => $provinces, 'wards' => $wards, 'typeHotel' => $typeHotel));
 }
Esempio n. 15
0
 public function showProvince($id_city)
 {
     $province = Cities::where('id', $id_city)->select('province_id')->first();
     $data = Provinces::find($province->province_id);
     return Response::json($data);
 }
Esempio n. 16
0
<?php

require "Users.php";
require "Provinces.php";
$nombre = $_REQUEST['first_name'];
$last_name = $_REQUEST['last_name'];
$nombre_usuario = $_REQUEST['nombre_usuario'];
$email = $_REQUEST['email'];
$provincias = $_REQUEST['provincias'];
$USER = new Users($nombre, $last_name, $nombre_usuario, $email);
$id = $USER->Save();
foreach ($provincias as $value) {
    Provinces::InsertarRelacion($id, $value);
}
header("Location: http://localhost/practica2/PHP/cargarusuario.php?id_usuario={$id}");
 public function getDataInstansi($value = '')
 {
     $data = ['provinces' => Provinces::all(), 'data' => DataInstansi::find(1)];
     return View::make('admin.datainstansi', $data);
 }
Esempio n. 18
0
 public function showProvince()
 {
     return Response::json(Provinces::all()->toArray());
 }
<?php

require "Users.php";
require "Provinces.php";
$id = $_GET['id_usuario'];
echo Users::Cargar_Usario($id);
echo Provinces::CargarProvincias_Usuario($id);
Esempio n. 20
0
 public function details($id)
 {
     if (Auth::check()) {
         $currentPage = "CUSTOMERS_LIST";
         $mainMenu = "CUSTOMERS_MAIN";
         $inputs = Input::all();
         if (isset($inputs['customerName'])) {
             if (Customers::addCustomers($inputs)) {
                 Session::flash('msg', "Customer added successfully.");
             } else {
                 Session::flash('warning', "Customer, Course Could not be added at the moment.");
             }
         }
         $customer = Customers::getCustomersById($id);
         $students = Students::getStudentByCustomer($id);
         $comments = Comments::getCommentByCustomerId($id);
         $provinces = Provinces::getProvinces("IN");
         $kidsSelect = Students::getStudentsForSelectBox($id);
         $membershipTypes = MembershipTypes::getMembershipTypesForSelectBox();
         $birthdays = BirthdayParties::getBirthdaysByCustomer($id);
         //return $customer;
         //Membership
         if (isset($inputs['membershipTypesMembersDiv'])) {
             /* echo '<pre>';
             			print_r($inputs);
             			echo '</pre>';
             			exit(); */
             if ($inputs['membershipTypesMembersDiv'] != "") {
                 $membershipInput['customer_id'] = $id;
                 $membershipInput['membership_type_id'] = $inputs['membershipTypesMembersDiv'];
                 CustomerMembership::addMembership($membershipInput);
                 $order['customer_id'] = $id;
                 $order['payment_for'] = "membership";
                 $order['payment_dues_id'] = '';
                 $order['payment_mode'] = $inputs['paymentTypeRadio'];
                 $order['card_last_digit'] = $inputs['card4digits'];
                 $order['card_type'] = $inputs['cardType'];
                 $order['bank_name'] = $inputs['bankName'];
                 $order['cheque_number'] = $inputs['chequeNumber'];
                 $order['amount'] = $inputs['membershipPrice'];
                 $order['order_status'] = "completed";
                 Orders::createOrder($order);
             }
         }
         //$customerMembership = "";
         /* echo '<pre>';
         			print_r($customer);
         			echo '</pre>';
         			exit(); */
         $presentDate = Carbon::now();
         $membershipStartDate = Carbon::now();
         $membershipEndDate = Carbon::now();
         $customerMembershipId = '';
         if (isset($customer->CustomerMembership['0'])) {
             $select = count($customer->CustomerMembership) - 1;
             $membershipStartDate = $membershipStartDate->createFromFormat('Y-m-d', $customer->CustomerMembership[$select]->membership_start_date);
             $membershipEndDate = $membershipEndDate->createFromFormat('Y-m-d', $customer->CustomerMembership[$select]->membership_end_date);
             if ($membershipStartDate->lte($presentDate) && $membershipEndDate->gte($presentDate)) {
                 $customerMembershipId = $customer->CustomerMembership[$select]->membership_type_id;
             }
         }
         if (isset($customerMembershipId)) {
             $customerMembership = MembershipTypes::getMembershipTypeByID($customerMembershipId);
         }
         $membershipTypesAll = MembershipTypes::getMembershipTypes();
         $birthdaypaiddata = Orders::getBirthdayfulldata($id);
         for ($i = 0; $i < count($birthdaypaiddata); $i++) {
             $studentData = Students::getStudentById($birthdaypaiddata[$i]['student_id']);
             $birthdaypaiddata[$i]['student_name'] = $studentData[0]['student_name'];
             $birthdaypaiddata[$i]['student_date_of_birth'] = $studentData[0]['student_date_of_birth'];
             $birthdayData = BirthdayParties::getBirthdaybyId($birthdaypaiddata[$i]['birthday_id']);
             $birthdaypaiddata[$i]['birthday_party_date'] = $birthdayData[0]['birthday_party_date'];
             $birthdaypaiddata[$i]['tax_amount'] = $birthdaypaiddata[0]['tax_amount'];
             $user_data = User::getUsersByUserId($birthdaypaiddata[$i]['created_by']);
             $birthdaypaiddata[$i]['name'] = $user_data[0]['first_name'] . $user_data[0]['last_name'];
             $birthdaypaiddata[$i]['encrypted_id'] = Crypt::encrypt($birthdaypaiddata[$i]['id']);
         }
         $birthdayDuedata = PaymentDues::getPaymentpendingfulldata($id);
         for ($i = 0; $i < count($birthdayDuedata); $i++) {
             $studentData = Students::getStudentById($birthdayDuedata[$i]['student_id']);
             $birthdayDuedata[$i]['student_name'] = $studentData[0]['student_name'];
             $user_data = User::getUsersByUserId($birthdayDuedata[$i]['created_by']);
             $birthdayDuedata[$i]['name'] = $user_data[0]['first_name'] . $user_data[0]['last_name'];
             $birthdayData = BirthdayParties::getBirthdaybyId($birthdayDuedata[$i]['birthday_id']);
             $birthdayDuedata[$i]['birthday_party_date'] = $birthdayData[0]['birthday_party_date'];
         }
         //followup_data
         $iv_data = IntroVisit::where('customer_id', '=', $id)->get();
         for ($i = 0; $i < count($iv_data); $i++) {
             $comments_data = Comments::where('introvisit_id', '=', $iv_data[$i]['id'])->orderBy('id', 'DESC')->first();
             $iv_data[$i]['comment_data'] = $comments_data;
             $student = Students::find($iv_data[$i]['student_id']);
             $iv_data[$i]['student_name'] = $student['student_name'];
             $iv_data[$i]['iv_date'] = date("Y-m-d", strtotime($iv_data[$i]['iv_date']));
         }
         $birthday_data = BirthdayParties::where('customer_id', '=', $id)->get();
         for ($i = 0; $i < count($birthday_data); $i++) {
             $birthday_comments = Comments::where('birthday_id', '=', $birthday_data[$i]['id'])->orderBy('id', 'DESC')->first();
             $birthday_data[$i]['comment_data'] = $birthday_comments;
             $student_data = Students::find($birthday_data[$i]['student_id']);
             $birthday_data[$i]['student_name'] = $student_data['student_name'];
             $birthday_data[$i]['birthday_party_date'] = date("Y-m-d", strtotime($birthday_data[$i]['birthday_party_date']));
         }
         //for complaints
         $complaint_data = Complaint::getComplaintByCustomerId($id);
         //Comments::where('customer_id','=',$id)->get();
         for ($i = 0; $i < count($complaint_data); $i++) {
             $complaint_data[$i]['comments'] = Comments::where('complaint_id', '=', $complaint_data[$i]['id'])->orderBy('id', 'DESC')->first();
             $student_data = Students::find($complaint_data[$i]['student_id']);
             $complaint_data[$i]['student_name'] = $student_data['student_name'];
         }
         //for retention
         $retention_data = Retention::getRetentionByCustomerId($id);
         for ($i = 0; $i < count($retention_data); $i++) {
             $retention_data[$i]['comments'] = Comments::where('retention_id', '=', $retention_data[$i]['id'])->orderBy('id', 'DESC')->first();
             $student_data = Students::find($retention_data[$i]['student_id']);
             $retention_data[$i]['student_name'] = $student_data['student_name'];
         }
         //for inquiry
         $inuiry_data = Inquiry::getInquiryByCustomerId($id);
         for ($i = 0; $i < count($inuiry_data); $i++) {
             $inuiry_data[$i]['comments'] = Comments::where('inquiry_id', '=', $inuiry_data[$i]['id'])->orderBy('id', 'DESC')->first();
         }
         //for enrollment payment followup/brush up calls
         $enrollmentFollowupData = PaymentFollowups::getPaymentFollowupByCustomerId($id);
         for ($i = 0; $i < count($enrollmentFollowupData); $i++) {
             $enrollmentFollowupData[$i]['comments'] = Comments::where('paymentfollowup_id', '=', $enrollmentFollowupData[$i]['id'])->orderBy('id', 'DESC')->first();
             $student_data = Students::find($enrollmentFollowupData[$i]['student_id']);
             $enrollmentFollowupData[$i]['student_name'] = $student_data['student_name'];
             $paymentDueData = PaymentDues::find($enrollmentFollowupData[$i]['payment_due_id']);
             $enrollmentFollowupData[$i]['payment_date'] = $paymentDueData['end_order_date'];
         }
         // for customer kids enrollment.
         $customer_student_data = Students::where('customer_id', '=', $id)->where('franchisee_id', '=', Session::get('franchiseId'))->select('id', 'student_name')->get();
         for ($i = 0; $i < count($customer_student_data); $i++) {
             $student_classes = StudentClasses::getEnrolledStudentBatch($customer_student_data[$i]['id']);
             //return $student_classes[0]['batch_id'];
             $customer_student_data[$i]['student_classes_data'] = $student_classes;
         }
         //return $customer_student_data;
         for ($i = 0; $i < count($customer_student_data); $i++) {
             for ($j = 0; $j < count($customer_student_data[$i]['student_classes_data']); $j++) {
                 $find = Batches::find($customer_student_data[$i]['student_classes_data'][$j]['batch_id']);
                 $customer_student_data[$i]['student_classes_data'][$j]['batch_name'] = $find->batch_name;
             }
         }
         //return the customer membership follolwup
         $customer_membership_data = MembershipFollowup::where('customer_id', '=', $id)->get();
         for ($i = 0; $i < count($customer_membership_data); $i++) {
             $membershipid[$i] = $customer_membership_data[$i]['id'];
         }
         if (isset($membershipid)) {
             for ($i = 0; $i < count($membershipid); $i++) {
                 $membership_followup_data[$i] = Comments::where('membership_followup_id', '=', $membershipid[$i])->orderBy('id', 'DESC')->first();
                 $memfollowup_data = MembershipFollowup::find($membershipid[$i]);
                 $Customer_membership_data = CustomerMembership::find($memfollowup_data->membership_id);
                 $membership_followup_data[$i]['membership_end_date'] = $Customer_membership_data->membership_end_date;
             }
         }
         $viewData = array('birthdaypaiddata', 'birthdayDuedata', 'customer', 'students', 'currentPage', 'mainMenu', 'comments', 'provinces', 'customerMembership', 'kidsSelect', 'membershipTypes', 'membershipTypesAll', 'birthdays', 'iv_data', 'birthday_data', 'complaint_data', 'retention_data', 'inuiry_data', 'enrollmentFollowupData', 'customer_student_data', 'membership_followup_data');
         return View::make('pages.customers.details', compact($viewData));
     } else {
         return Redirect::to("/");
     }
 }
Esempio n. 21
0
<?php

require "PHP/Provinces.php";
?>
<!Doctype>
<html lang="es">
	<head>
		<meta charset="utf-8"/>

	</head>
	<body>	
		<form action="PHP/save.php" method="POST">
			<label>Nombre: </label><input type="text" name="first_name" /></br>
			<label>Apellido: </label><input type="text" name="last_name" /></br>
			<label>Nombre Usuario: </label><input type="text" name="nombre_usuario" /></br>
			<label>Email: </label><input type="email" name="email" /></br>

			I have friends in
			<br/>
			
			<?php 
echo Provinces::get_all();
?>
			<input type="submit" value="Guardar"/>
		</form>
	</body>
</html>