Inheritance: extends Illuminate\Database\Migrations\Migration
コード例 #1
0
 function getSearch()
 {
     $searchinput = Input::get('q');
     $allCoupons = Coupons::where('tags', 'LIKE', '%' . $searchinput . '%')->paginate(20);
     $type = 'search';
     $data = array('pageTitle' => 'CouponJadu - Search', 'allCoupons' => $allCoupons, 'allCategories' => $this->allCategories, 'allStores' => $this->allStores, 'type' => $type);
     return View::make('home', $data);
 }
コード例 #2
0
ファイル: _view.php プロジェクト: bhaiyyalal/testcode
                <div class="row">
                    <div class="col-xs-2 ticket_icon">
                        <i class="fa fa-ticket fa-5x"></i>
                    </div>
                    <div class="col-xs-5">
                        <h2><?php 
echo CHtml::encode($model->ticket_title);
?>
</h2>
                        <div class="project_meta_details">
                            <?php 
$orderDetails = Orders::model()->findByAttributes(array("order_id" => $model->order_id));
$Total_amount = $orderDetails['currency'] . " " . $orderDetails['order_total'];
$attrList = json_decode($orderDetails['order_Data']);
$coupon_id = $orderDetails['coupon_id'];
$couponDetails = Coupons::model()->findByAttributes(array("id" => $coupon_id));
$clientInfo = $attrList->userdata;
$days = round($attrList->numofworkingday / 8);
$fwdby = TicketAssign::model()->findByAttributes(array('ticket_id' => $ticket_id, 'fwd_to' => Yii::app()->session['user_data']['user_id'], 'status' => 1));
$fwd_name = '';
if (!empty($fwdby)) {
    $fwd_name = ucfirst(Users::model()->getUserName($fwdby->fwd_by));
}
?>
                           
                            <p>Client: <strong><a href=""></a> <?php 
echo ucfirst(Users::model()->getUserName($orderDetails['client_id']));
?>
</strong></p>                            
                            <p>Priority: <strong><?php 
echo ucfirst($attrList->order->priority);
コード例 #3
0
 public function postRefund()
 {
     $postdata = Input::all();
     $panIDPK = Input::get('pan_id_pk');
     $currenttime = Commonmodel::dateandtime();
     if (!$panIDPK) {
         return Response::json(array('status' => "failed", 'message' => 'Please send a PAN ID'));
     } else {
         $findrefuncid = Panoffiline::find($panIDPK);
         if ($findrefuncid) {
             $getcurrentuser = Panoffiline::where('pan_id_pk', '=', $panIDPK)->pluck('pan_created_by');
             $response = Panoffiline::where('pan_id_pk', $panIDPK)->get();
             if ($response) {
                 foreach ($response as $res) {
                     $userfinID = $res->pan_created_by;
                     $panCoupenNo = $res->pan_coupon_no;
                     $mainBalance = Userfinance::where('ufin_user_id', $userfinID)->pluck('ufin_main_balance');
                     $panTotBal = $mainBalance + 106;
                     $balanceDebit = array('ufin_main_balance' => $panTotBal);
                     if ($panCoupenNo != '0') {
                         Userfinance::where('ufin_user_id', '=', $userfinID)->update($balanceDebit);
                         $coupenReset = array('pan_coupon_no' => '');
                         Panoffiline::where('pan_id_pk', '=', $panIDPK)->update($coupenReset);
                         $panCoupenUpdate = array('pc_coupon_no' => $panCoupenNo);
                         $procode = Products::where('prod_short_name', '=', 'PANM')->pluck('prod_code');
                         $panledger = array('lr_date' => $currenttime, 'lr_trans_type' => 'CR', 'lr_comment' => 'Pan Refund', 'lr_credit_amount' => '106', 'lr_post_balance' => $panTotBal, 'lr_created_by' => $getcurrentuser, 'lr_prod_code' => $procode);
                         $panlegcreta = new Ledgerreport();
                         $panlegcreta->create($panledger);
                         $coupen = new Coupons();
                         $coupen->create($panCoupenUpdate);
                         return Response::json(array('status' => "success", 'message' => 'Amount debited successfully'));
                     } else {
                         return Response::json(array('status' => "failure", 'message' => 'PAN Card has been already applied for refund'));
                     }
                 }
             }
         } else {
             return Response::json(array('status' => "failure", 'message' => 'No User found for this ID'));
         }
     }
 }
コード例 #4
0
ファイル: CurrentCart.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * Remove coupon from cart
  * @param 	int		$cnId coupon ID
  * @return	bool		true on sucess
  */
 public function removeCoupon($cnId)
 {
     $coupons = new Coupons();
     // If user is logged in return coupon back to the coupons pool.
     $juser = User::getInstance();
     if ($juser->id) {
         $coupons->recycle($cnId);
     }
     // Remove coupon
     $sql = "DELETE FROM `#__cart_coupons` WHERE `cnId` = " . $this->_db->quote($cnId) . " AND `crtId` = " . $this->_db->quote($this->crtId);
     $this->_db->setQuery($sql);
     //echo $this->_db->_sql;
     $this->_db->query();
     return true;
 }
コード例 #5
0
ファイル: Cron.class.php プロジェクト: mozdial/Directory
    /**
     * Run - called by outside cron
     */
    public static function Run()
    {
        // add here your code...
        // Class::Method();
        $perform_actions = false;
        // update last time running
        $sql = 'SELECT
					cron_type,
					cron_run_last_time,
					cron_run_period,
					cron_run_period_value,
					CASE
						WHEN cron_run_last_time = \'0000-00-00 00:00:00\' THEN \'999\'
						WHEN cron_run_period = \'minute\' THEN TIMESTAMPDIFF(MINUTE, cron_run_last_time, \'' . date('Y-m-d H:i:s') . '\')
						ELSE TIMESTAMPDIFF(HOUR, cron_run_last_time, \'' . date('Y-m-d H:i:s') . '\')
					END as time_diff										
				FROM ' . TABLE_SETTINGS;
        $result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
        if ($result['cron_type'] == 'batch') {
            $perform_actions = true;
        } else {
            if ($result['cron_type'] == 'non-batch' && $result['time_diff'] > $result['cron_run_period_value']) {
                $perform_actions = true;
            } else {
                $perform_actions = false;
            }
        }
        if ($perform_actions) {
            // update Feeds
            RSSFeed::UpdateFeeds();
            if (self::$PROJECT == 'ShoppingCart') {
                // close expired discount campaigns
                Campaigns::UpdateStatus();
                // remove expired orders
                Orders::RemoveExpired();
            } else {
                if (self::$PROJECT == 'HotelSite') {
                    // close expired discount campaigns
                    Campaigns::UpdateStatus();
                    // close expired coupons
                    Coupons::UpdateStatus();
                    // remove expired 'Preparing' bookings
                    Bookings::RemoveExpired();
                } else {
                    if (self::$PROJECT == 'BusinnessDirectory') {
                        // close expired lisitngs
                        Listings::UpdateStatus();
                        // remove old inquiries
                        Inquiries::RemoveOld();
                    } else {
                        if (self::$PROJECT == 'MedicalAppointment') {
                            // remove expired appointments
                            Appointments::RemoveExpired();
                            // send reminders for patient and doctor
                            Appointments::SendReminders();
                        } else {
                            if (self::$PROJECT == 'MicroBlog') {
                                // close expired polls
                                Pools::UpdateStatus();
                            }
                        }
                    }
                }
            }
            // update last time running
            $sql = 'UPDATE ' . TABLE_SETTINGS . ' SET cron_run_last_time = \'' . date('Y-m-d H:i:s') . '\'';
            database_void_query($sql);
        }
    }
コード例 #6
0
 public function actionGetOrderlList()
 {
     $data = $_REQUEST['Coupons'];
     $result = array();
     $newResult = array();
     if (!empty($data['coupon_code'])) {
         $limit = 20;
         $page = $data['page'];
         $offset = ($page - 1) * $limit;
         $result = array();
         $coupon_code = trim($data['coupon_code']);
         // $coupon_type = $data['coupon_type'];
         $validate_from = $data['validate_from'];
         $validate_to = $data['validate_to'];
         $Couponid = Coupons::model()->findByAttributes(array("coupon_code" => $coupon_code, "status" => 1));
         if (!empty($Couponid['id'])) {
             if (!empty($validate_from)) {
                 $orderTotal = count(Orders::model()->findAllByAttributes(array("coupon_id" => $Couponid['id']), array("condition" => "order_date >= '{$validate_from}' AND order_date <= '{$validate_to} 23:59:59'")));
                 $orderList = Orders::model()->findAllByAttributes(array("coupon_id" => $Couponid['id']), array("condition" => "order_date >= '{$validate_from}' AND order_date <= '{$validate_to} 23:59:59'", 'limit' => $limit, "offset" => $offset));
             } else {
                 $orderTotal = count(Orders::model()->findAllByAttributes(array("coupon_id" => $Couponid['id'])));
                 $orderList = Orders::model()->findAllByAttributes(array("coupon_id" => $Couponid['id']), array('limit' => $limit, "offset" => $offset));
             }
         }
         foreach ($orderList as $val) {
             $ticketid = Ticket::model()->findByAttributes(array("order_id" => $val['order_id']));
             $result[] = array("order_id" => $val['order_id'], "url" => Yii::app()->createUrl("ticket/view", array("id" => base64_encode($ticketid['ticket_id']))), "client" => Users::model()->getUserName($val['client_id']), "amount" => $val['order_total'], "product_name" => $ticketid['ticket_title'], 'date' => date('d M Y @ g:i A', strtotime($val['order_date'])));
         }
         if (!empty($orderList)) {
             $newResult['pagination'] = $this->actionCreatePager($orderTotal, $limit, $page);
             $newResult['records'] = $result;
         }
     }
     echo json_encode($newResult);
 }
コード例 #7
0
ファイル: AdminController.php プロジェクト: afzydev/couponapp
 public function postEditCoupon($couponId)
 {
     $getData = Input::all();
     $saveData = array();
     foreach ($getData as $key => $value) {
         if (empty($value)) {
             if ($key != 'coupon_image') {
                 $saveData[] = 1;
                 return Redirect::to('admin/edit-coupon/' . $couponId)->with('error', 'Please complete all the fields')->withInput();
             }
         }
     }
     if (count($saveData) == 0) {
         if (!empty($getData['coupon_image'])) {
             $file = $getData['coupon_image'];
             $all_uploaded_files = array('jpg', 'png', 'jpeg');
             $destinationPath = public_path() . '/uploads/images/coupon';
             //$filename = str_random(12);
             $filename = $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             $final_img = $filename;
             list($width, $height, $type, $attr) = getimagesize($file);
             if (in_array($extension, $all_uploaded_files) && $width >= 300 && $height >= 150) {
                 $upload_success = $file->move($destinationPath, $final_img);
                 $img = Image::make($destinationPath . '/' . $final_img);
                 $img->resize(300, 150);
                 $img->save($destinationPath . '/' . $final_img);
                 $get_upload_img = Coupons::whereId($couponId)->lists('coupon_image');
                 $del_img = $get_upload_img[0];
                 File::delete(public_path() . '/uploads/images/coupon/' . $del_img);
             } else {
                 return Redirect::to('admin/edit-coupon/' . $couponId)->with('error', 'Upload only JPG,JPEG,PNG type images of 300X150 dimensions')->withInput();
             }
         } else {
             $get_img = Coupons::whereId($couponId)->lists('coupon_image');
             $final_img = $get_img[0];
         }
         $saveData = array('coupon_name' => $getData['coupon_name'], 'coupon_code' => $getData['coupon_code'], 'category_id' => $getData['category_id'], 'store_id' => $getData['store_id'], 'coupon_image' => $final_img, 'short_description' => $getData['short_description'], 'description' => $getData['description'], 'url' => $getData['url'], 'tags' => $getData['tags']);
         if (Coupons::whereId($couponId)->update($saveData)) {
             return Redirect::to('admin/edit-coupon/' . $couponId)->with('success', 'Successfuly Updated');
         }
     }
 }