Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $insert = $request->all();
     $safeName = false;
     //upload image
     if ($file = Input::file('image')) {
         $fileName = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension() ?: 'png';
         $folderName = '/uploads/';
         $destinationPath = Config::get('app.path') . $folderName;
         $safeName = time() . "_" . str_random(10) . '.' . $extension;
         $file->move($destinationPath, $safeName);
         $insert['image'] = $safeName ? $folderName . $safeName : '';
     }
     if (isset(Offer::$boolean)) {
         foreach (offer::$boolean as $field) {
             if (isset($insert[$field]) && $insert[$field] == "on") {
                 $insert[$field] = 1;
             }
         }
     }
     offer::create($insert);
     return redirect('admin/offers')->with('success', Lang::get('message.success.create'));
 }
Ejemplo n.º 2
0
 /**
  * Update Fields
  *
  * @param offer   $offer             - offer
  * @param array   $requestParams     - Request parameters
  * @param User    $user              - User
  * @param integer $practiceProfileId - Practice Profile Id
  *
  * @return null
  */
 public function updateFields($offer, $requestParams, $user, $practiceProfileId)
 {
     $errors = array();
     $offer->setAttributes($requestParams);
     $offer->setModifiedAt(new \DateTime('now'));
     $offer->setModifiedByUserId($user);
     $validationErrors = $this->validator->validate($offer);
     if (0 < count($validationErrors)) {
         foreach ($validationErrors as $validationError) {
             $pattern = '/([a-z])([A-Z])/';
             $replace = function ($m) {
                 return $m[1] . '_' . strtolower($m[2]);
             };
             $attribute = preg_replace_callback($pattern, $replace, $validationError->getPropertyPath());
             @($errors[$attribute][] = $validationError->getMessage());
         }
     }
     if (0 < count($errors)) {
         throw new ValidationError($errors);
     }
     return;
 }
Ejemplo n.º 3
0
		</ol>
		<!-- End breadcrumb -->
		
		<div class="panel panel-info">
		  <div class="panel-heading">
		  	<div class="right-content">
				<a href="add_offer.php"><button class="btn btn-success btn-perspective btn-lg pull-right">ADD PRODUCT OFFER</button></a>
			</div>
			<h3>View Offers</h3>
		  </div>
		  <div class="panel-body">
			<!-- BEGIN DATA TABLE -->
			<div class="the-box">
				<div class="table-responsive">
					<?php 
$offer = new offer();
$results = $offer->get_products();
if ($results) {
    ?>
						<table class="table table-striped table-hover" id="datatable-example">
							<thead class="the-box dark full">
								<tr>
									<th>Name</th>
									<th>Min Purchase</th>
									<th>Offer Status</th>
								</tr>
							</thead>
							<tbody>
								<?php 
    foreach ($results as $res) {
        ?>
Ejemplo n.º 4
0
 * @version     5
 * 
 * @copyright   Copyright (C) 2006 - 2014 Critter BVBA All rights reserved.
 * @license     GNU General Public License version 3 or later; see license.txt
 * 
 * showitem.offer.php
 * 
 * showitem.offer dialog
 * 
 */
// enable or disable logging
error_reporting(E_ALL);
ini_set('display_errors', '1');
// 0 - disabled; 1 - enabled
//
$o = new offer($data->data->id);
$o->details();
$sql = "SELECT `id`,`name` FROM `##_" . $_SESSION['space'] . "_entity` WHERE `deleted`=0 AND `id`>0 ORDER BY `name`;";
$DBO->query($sql);
$cust = $DBO->result("objectlist");
if ($o->get("entity_id") == null) {
    $o->set("entity_id", $cust[0]->id);
}
$sql = "SELECT `id`,`name` FROM `##_" . $_SESSION['space'] . "_vat` WHERE `deleted`=0 AND `id`>0 ORDER BY `name`;";
$DBO->query($sql);
$vat = $DBO->result("objectlist");
$sql = "SELECT `id`,`name` FROM `##_" . $_SESSION['space'] . "_currency` WHERE `deleted`=0 AND `id`>0 ORDER BY `name`;";
$DBO->query($sql);
$curr = $DBO->result("objectlist");
$sql = "SELECT `a`.`id`,CONCAT(`a`.`name`,' - ',`a`.`sku`,' - ',`b`.`sign`,' ',`a`.`indicative_price`) `name` \n                FROM `##_" . $_SESSION['space'] . "_inventory_item` `a` \n                LEFT JOIN `##_" . $_SESSION['space'] . "_currency` `b` ON (`a`.`indicative_currency_id` = `b`.`id`)\n                WHERE `a`.`deleted`=0 AND `a`.`id`>0 ORDER BY `name`;";
$DBO->query($sql);
Ejemplo n.º 5
0
			<li><a href="view_offer.php">Offer</a></li>
			<li class="active">Add Offer</li>
		</ol>

		<div class="panel panel-info">
		  <div class="panel-heading">
			<h3><?php 
echo isset($_GET['id']) ? 'Update' : 'Add';
?>
 Offer</h3>
		  </div>
		  <div class="panel-body">
			<?php 
$product = new product();
$all_product = $product->get_product();
$offer = new offer();
$ID = isset($_GET['id']) ? $_GET['id'] : NULL;
if (isset($_POST['add_offer'])) {
    // Update old record
    if (isset($ID)) {
        $results = $offer->update_offer($_POST, $ID);
    } else {
        // Insert new
        $results = $offer->insert_offer($_POST);
    }
    if ($results) {
        echo '<div class="alert alert-success" role="alert"> Add Offer Sucessfully </div>';
    } else {
        echo '<div class="alert alert-danger" role="alert"> Error </div>';
    }
}
Ejemplo n.º 6
0
$o = new transaction($data->data->id);
$o->details();
$sql = "SELECT `id`,CONCAT(`name`, ' (',`uid`,')') `name` FROM `##_" . $_SESSION['space'] . "_entity` WHERE `deleted`=0 AND `id`>0 ORDER BY `name`;";
$DBO->query($sql);
$cust = $DBO->result("objectlist");
if ($o->get("id") == -1) {
    $entity_id = $cust[0]->id;
} else {
    $entity_id = $o->get("entity_id");
}
$sql = "SELECT `id`,`reference` FROM `##_" . $_SESSION['space'] . "_offer` WHERE `deleted`=0 AND `id`>0 AND `entity_id`='" . $entity_id . "' ORDER BY `reference`;";
$DBO->query($sql);
$offer = $DBO->result("objectlist");
if ($o->get("id") == -1) {
    $offer_id = $offer[0]->id;
    $OFFER = new offer($offer_id);
    $OFFER->details();
    $deadline = $OFFER->get("payment");
} else {
    $offer_id = $o->get('offer_id');
    $deadline = $o->get('deadline');
}
$sql = "SELECT `a`.`id`,CONCAT(`a`.`sku`,' - ',`a`.`name`,' - ',`a`.`price`) `name`\n                FROM `##_" . $_SESSION['space'] . "_offer_item` `a` \n                WHERE `offer_id`='" . $offer_id . "'\n                AND `id`>-1\n                ORDER BY `name`;";
$DBO->query($sql);
$items = $DBO->result("objectlist");
?>
<div class="title"><?php 
echo ucwords($o->get("id") == -1 ? TRANSACTION_NEW_TRANSACTION : TRANSACTION_EDIT_TRANSACTION);
?>
</div>
<div class="form">
Ejemplo n.º 7
0
// enable or disable logging
error_reporting(E_ALL);
ini_set('display_errors', '1');
// 0 - disabled; 1 - enabled
//
$sql = "SELECT `a`.`name`, `b`.`id`,`b`.`uid`,`b`.`reference`,DATE_FORMAT(`b`.`date`,'%Y-%m-%d') `date`, DATE_FORMAT(DATE_ADD(`b`.`date`,INTERVAL `b`.`deadline` DAY),'%Y-%m-%d') `duedate`, `b`.`id` `transaction_id`,`b`.`offer_id`\n            FROM `##_" . $_SESSION['space'] . "_entity` `a`\n            LEFT JOIN `##_" . $_SESSION['space'] . "_transaction` `b` ON (`a`.`id`=`b`.`entity_id`)\n            WHERE `b`.`satisfied`=0 AND `b`.`id`>-1\n            AND DATE_ADD(`b`.`date`,INTERVAL `b`.`deadline` DAY)<CURDATE()\n            ORDER BY `a`.`name` asc, `duedate` desc;";
$DBO->query($sql);
$customer = "";
$count = 0;
?>
<div class="dashboard">
<?php 
foreach ($DBO->result("objectlist") as $row) {
    $TRANSACTION = new transaction($row->transaction_id);
    $TRANSACTION->details();
    $OFFER = new offer($row->offer_id);
    $OFFER->details();
    if ($row->name != $customer) {
        $customer = $row->name;
        if ($count != 0) {
            echo "</div>";
        }
        ?>
<div class="customer"><?php 
        echo $row->name;
        ?>
</div>
<div class="itemlist">
<?php 
    }
    ?>