/**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $types = Types::dropdownList();
     $units = Units::dropdownList();
     $suppliers = Suppliers::dropdownList();
     return View::make('products.create', compact('types', 'units', 'suppliers'));
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     //Suppliers::truncate();
     $address = Addresses::all()->lists('id');
     for ($i = 0; $i < 20; $i++) {
         $suppliers = Suppliers::create(array('name' => $faker->company, 'phone' => $faker->phoneNumber, 'email' => $faker->email, 'addressId' => $faker->randomElement($address)));
     }
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     //Products::truncate();
     $suppliers = Suppliers::all()->lists('id');
     $categories = Categories::all()->lists('id');
     for ($i = 0; $i < 20; $i++) {
         $products = Products::create(array('name' => $faker->word, 'quantity' => $faker->numberBetween(1, 900), 'unitPrice' => $faker->randomFloat(5, 1, 5000), 'details' => $faker->text, 'color' => $faker->colorName, 'supplierProductId' => $faker->randomNumber, 'supplierId' => $faker->randomElement($suppliers), 'categoryId' => $faker->randomElement($categories)));
     }
 }
Пример #4
0
$header = 'Информация о поставщике';
$tpl->Assign('h1', $header);
$GLOBALS['IERA_LINKS'][] = array('title' => $header, 'url' => _base_url . '/cabinet/assortment/');
if (!isset($GLOBALS['REQAR'][1]) || !is_numeric($GLOBALS['REQAR'][1])) {
    header('Location: ' . _base_url . '/adm/404/');
    exit;
}
$id_supplier = $GLOBALS['REQAR'][1];
$tpl->Assign('id_supplier', $id_supplier);
$order = 'p.id_product ASC';
if (isset($_GET['sort']) && $_GET['sort'] != '' && isset($_GET['order']) && $_GET['order'] != '') {
    $order = $_GET['sort'] . ' ' . $_GET['order'];
}
$Users = new Users();
$Products = new Products();
$Supplier = new Suppliers();
$arr = false;
if (isset($_GET['smb'])) {
    // unset($_GET);
    if (isset($_GET['filter_date_from']) && $_GET['filter_date_from'] !== '') {
        $edited_time_from = $_GET['filter_date_from'];
        list($d, $m, $y) = explode(".", trim($edited_time_from));
        $edited_time_from = mktime(0, 0, 0, $m, $d, $y);
    }
    if (isset($_GET['filter_date_to']) && $_GET['filter_date_to'] !== '') {
        $edited_time_to = $_GET['filter_date_to'];
        // list($d,$m,$y) = explode(".", trim($edited_time_to));
        // $edited_time_to = mktime(0, 0, 0, $m , $d, $y);
    }
    $arr['edited_time'] = array($edited_time_from, $edited_time_to);
    if (isset($_GET['filter_active']) && $_GET['filter_active'] !== '') {
Пример #5
0
<?php

if (!isset($GLOBALS['REQAR'][1]) && !is_numeric($GLOBALS['REQAR'][1])) {
    header('Location: /404/');
    exit;
}
$id_supplier = $GLOBALS['REQAR'][1];
unset($parsed_res);
$User = new Users();
$User->SetFieldsById($id_supplier);
$Supplier = new Suppliers();
$Supplier->SetFieldsById($id_supplier, 1);
$supplier = $Supplier->fields;
$arr = $Supplier->GetDataForAct();
$tpl->Assign('products', $arr);
foreach ($arr as $key => $i) {
    if ($i['inusd'] == 1) {
        $supplier['usd_products']++;
    }
}
$tpl->Assign("Supplier", $supplier);
echo $tpl->Parse($GLOBALS['PATH_tpl'] . 'act_supplier' . ($_GET['type'] ? '_' . $_GET['type'] : null) . '.tpl');
$e_time = G::getmicrotime();
echo "<!--" . date("d.m.Y H:i:s", time()) . "  " . $_SERVER['REMOTE_ADDR'] . " gentime = " . ($e_time - $s_time) . " -->";
exit(0);
Пример #6
0
     $orders_data[$order_id]['addr_deliv'] = "Самовывоз";
     $orders_data[$order_id]['addr_descr'] = $orders_data[$order_id]['descr'];
 } elseif ($orders_data[$order_id]['id_delivery'] == 2) {
     // Передать автобусом
     $orders_data[$order_id]['addr_deliv'] = "Передать автобусом - " . $city['names_regions'];
     $orders_data[$order_id]['addr_descr'] = $orders_data[$order_id]['descr'];
 } elseif ($orders_data[$order_id]['id_delivery'] == 3) {
     // служба доставки
     $orders_data[$order_id]['ds'] = $city['shipping_comp'];
     $orders_data[$order_id]['addr_deliv'] = $city['names_regions'] . "<br>" . $city['address'];
     $orders_data[$order_id]['addr_descr'] = $orders_data[$order_id]['descr'];
 }
 $Invoice = new Invoice();
 $orders_data[$order_id]['invoice_data'] = $Invoice->GetOrderData($order_id);
 //Получаем поставщиков
 $Supplier = new Suppliers();
 $Order->GetSuppliers($order_id);
 $suppliers = $Order->list;
 foreach ($suppliers as $k => &$s) {
     if ($s['id_supplier'] == 0) {
         $s['name'] = "Прогноз";
     }
     $Order->SetListBySupplier($s['id_supplier'], $order_id);
     $sum = 0;
     $sum_mopt = 0;
     $sum_otpusk = 0;
     $sum_mopt_otpusk = 0;
     if (!isset($suppliers_data[$k])) {
         $suppliers[$k]['sweight'] = 0;
         $suppliers[$k]['svolume'] = 0;
     } else {
Пример #7
0
<?php

if (!_acl::isAllow('users')) {
    die("Access denied");
}
$User = new Users();
$Supplier = new Suppliers();
unset($parsed_res);
if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) {
    $id_user = $GLOBALS['REQAR'][1];
} else {
    header('Location: /404/');
    exit;
}
$tpl->Assign('h1', 'Редактирование поставщика');
$ii = count($GLOBALS['IERA_LINKS']);
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Пользователи";
$GLOBALS['IERA_LINKS'][$ii++]['url'] = '/adm/users/';
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Редактирование поставщика";
if (!$Supplier->SetFieldsById($id_user, 1)) {
    die('Ошибка при выборе пользователя.');
}
if (isset($_POST['clear-assort'])) {
    if ($Supplier->DelSupplierAssort($id_user)) {
        echo '<script>alert("Все прошло успешно!");</script>';
    } else {
        echo '<script>alert("Произошла ошибка. Обратитесь к администратору");</script>';
    }
}
if (isset($_POST['smb'])) {
    require_once $GLOBALS['PATH_block'] . 't_fnc.php';
<?php

$GLOBALS['IERA_LINKS'][] = array('title' => $header, 'url' => _base_url . '/cabinet/');
$no_tpl = '';
$suppliers = new Suppliers();
$suppliers->RecalcWhSupplierSalePrice();
if (isset($_GET['toggle_supplier'])) {
    $active = '';
    if ($_GET['toggle_supplier'] == 0) {
        $active = 'on';
    }
    $arr = array("id_user" => $_GET['id'], "active" => $active);
    if (!$User->UpdateUser($arr)) {
        $this->db->errno = $User->db->errno;
        $this->db->FailTrans();
        return false;
    }
    if ($suppliers->SwitchEnableDisableProductsInAssort($_GET['id'], $_GET['toggle_supplier'])) {
        header('Location: ' . $_SERVER['HTTP_REFERER']);
        exit;
    }
}
$sort_list = array("article", "name", "real_email", "next_update_date", "real_phone", "inusd desc, currency_rate asc", "active");
isset($_POST['sort']) ? $tpl->Assign('sort', $_POST['sort']) : null;
$arr = false;
if (isset($_POST['smb'])) {
    if ($_POST['filter_article'] !== '') {
        $arr['article'] = '*' . mysql_real_escape_string($_POST['filter_article']) . '*';
    }
    if ($_POST['filter_name'] !== '') {
        $arr['name'] = '*' . mysql_real_escape_string($_POST['filter_name']) . '*';
Пример #9
0
<?php

ini_set("display_errors", 1);
error_reporting(E_ALL);
// if(!_acl::isAllow('product')){
// 	die("Access denied");
// }
$users = new Users();
$Products = new Products();
$suppliers = new Suppliers();
$header = 'Товары фотографа';
$ii = count($GLOBALS['IERA_LINKS']);
$GLOBALS['IERA_LINKS'][$ii]['title'] = $header;
$GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/photo_products/';
$tpl->Assign('header', $header);
if (isset($_POST['change_user'])) {
    header('Location: /adm/photo_products/' . $_POST['user']);
}
if ($_SESSION['member']['gid'] == _ACL_PHOTOGRAPHER_) {
    $id_photographer = $_SESSION['member']['id_user'];
} elseif (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) {
    $id_photographer = $GLOBALS['REQAR'][1];
}
$users->UsersList(1, array('gid' => _ACL_PHOTOGRAPHER_));
$tpl->Assign('users_list', $users->list);
$suppliers->SuppliersList();
$tpl->Assign('suppliers_list', $suppliers->list);
if (isset($id_photographer)) {
    $categories = $Products->generateCategory();
    $tpl->Assign('categories', $categories);
    $tpl->Assign('id_photographer', $id_photographer);
 public function getSuppliersName()
 {
     //return array(
     return CHtml::listData(Suppliers::model()->findAll(), 'id', 'name');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (!$id) {
         return Redirect::route('suppliers.index')->with('error', 'Please provide Supplier id');
     }
     $supplier = Suppliers::find($id);
     if (empty($supplier)) {
         return Redirect::route('suppliers.index')->with('error', 'Supplier not found');
     }
     Suppliers::destroy($id);
     return Redirect::route('suppliers.index')->with('success', 'Supplier deleted successfully');
 }
Пример #12
0
<?if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'){
	$Suppliers = new Suppliers();
	$Products = new Products();
	if(isset($_POST['action'])){
		switch($_POST['action']){
			case 'toggleSinglePrice':
				// Переключение единой цены у поставщика
				if(isset($_POST['single_price']) && isset($_POST['id_supplier'])){
					$Suppliers->UpdateSinglePrice($_POST['id_supplier'], $_POST['single_price']);
					$txt = json_encode('ok');
				}
				break;
			case 'exclusiveProduct':
				if(isset($_POST['id_product']) && isset($_POST['active']) && isset($_POST['id_supplier'])){
					if(checkNumeric($_POST, array('id_product','active','id_supplier'))){
						$Product->SetExclusiveSupplier($_POST['id_product'], $_POST['id_supplier'], $_POST['active']);
						$arr['id_product'] = $_POST['id_product'];
						$arr['id_supplier'] = $_POST['id_supplier'];
						$arr['active'] = $_POST['active'];
						echo json_encode($arr);
					}
				}
				break;
			case 'updateAssort':
				if(isset($_POST['mode']) && isset($_POST['id_product'])){
					$_POST['id_supplier'] = ($_SESSION['member']['gid']==_ACL_SUPPLIER_)?$_SESSION['member']['id_user']:$_POST['id_supplier'];
					$Products->UpdateAssort($_POST);
					$arr['id_product'] = $_POST["id_product"];
					$arr['error'] = false;
					$arr['opt'] = $_POST['mode'] == 'mopt'?0:1;
					$txt = json_encode($arr);
Пример #13
0
<?php

if (!_acl::isAllow('users')) {
    die("Access denied");
}
$User = new Users();
$Supplier = new Suppliers();
// ---- center ----
unset($parsed_res);
if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) {
    $id_user = $GLOBALS['REQAR'][1];
} else {
    header('Location: ' . $GLOBALS['URL_base'] . '404/');
    exit;
}
$tpl->Assign('h1', 'Удаление поставщика');
$ii = count($GLOBALS['IERA_LINKS']);
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Пользователи";
$GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/users/';
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Удаление поставщика";
if (!$Supplier->DelSupplier($id_user)) {
    die('Ошибка при удалении поставщика.');
}
$tpl->Assign('msg', 'Поставщик удален.');
$parsed_res = array('issuccess' => TRUE, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_message.tpl'));
if (TRUE == $parsed_res['issuccess']) {
    $tpl_center .= $parsed_res['html'];
}
// ---- right ----
Пример #14
0
 /**
  * @param int $count
  *
  * @return string
  */
 public static function generateSampleProducts($count = 10)
 {
     //		Type
     $typeIds = Producttype::getIdsOrCreateDummy();
     //		category
     $categoryIds = Productcategory::getIdsOrCreateSampelData();
     //		unit berat
     $unitIds = Units::getIdsOrCreateSampleUnits();
     //		parent_id
     $parentId = 0;
     $fake = static::getFake();
     //
     //		Buat Product
     $catId = $fake->getFake()->randomElement($categoryIds);
     $typeId = $fake->getFake()->randomElement($typeIds);
     $unitWeightId = $fake->getFake()->randomElement($unitIds);
     $unitWidthId = $fake->getFake()->randomElement($unitIds);
     $supplierIds = Suppliers::getRecordIdsOrCreate();
     $currencyIds = Currencies::getIdsOrCreateSample();
     //		color
     $colorIds = Colors::getIdsOrCreate();
     //  gradeIds
     $gradeIds = Fabricgrade::getIdsOrCreate();
     $productIds = array();
     for ($rec = 0; $rec < $count; $rec++) {
         $product = $fake->getProduct()->product($catId, $typeId, $unitWeightId, $unitWidthId, $parentId, '\\Emayk\\Ics\\Repo\\Productcategory\\Productcategory');
         $record = static::createRecord($product);
         $productId = $record->id;
         $productIds[] = $productId;
         //		Image/ Photo Product
         $imagesIds[] = Images::getIdsOrCreate($productId, '\\Emayk\\Ics\\Repo\\Products\\Products');
         //			Supplier Product
         //		Product Supplier (Product dapat dari Supplier mana ?)
         $supplierId = $fake->getFake()->randomElement($supplierIds);
         $supplierProduct = Productsuppliers::create(array('master_product_id' => $productId, 'master_supplier_id' => $supplierId));
         $supplierProductId = $supplierProduct->id;
         //			Create Detail
         //		Buat Product Detail
         $unitId = $fake->getFake()->randomElement($unitIds);
         $colorId = $fake->getFake()->randomElement($colorIds);
         $gradeId = $fake->getFake()->randomElement($gradeIds);
         $currSp = $fake->getFake()->randomElement($currencyIds);
         $currSpm = $fake->getFake()->randomElement($currencyIds);
         $detailIds[] = Productdetails::getIdOrCreate($productId, $colorId, $unitId, $gradeId, $currSp, $currSpm);
         //Buat Stock
         //		Buat Stock
         $stockIds[] = Stockproducts::createStock($productId);
     }
     foreach ($stockIds as $stockId) {
         for ($history = 0; $history < 9; $history++) {
             //		Buat Stock Detail/History277
             if ($history % 2 == 0 || $history == 0) {
                 $typeHistory = 'in';
             } else {
                 $typeHistory = 'out';
             }
             $firstHistory = $history == 0;
             //                $stockHistoryIds[] =
             Stockproducthistory::createHistoryStockSample($stockId, $typeHistory, $firstHistory);
         }
     }
     return "Sudah Generate sebanyak " . count($productIds) . " records";
     return s($productIds, $supplierProductId, $imagesIds, $detailIds);
 }
Пример #15
0
<?php

if (!_acl::isAllow('users')) {
    die('Access denied');
}
$User = new Users();
$Supplier = new Suppliers();
unset($parsed_res);
$tpl->Assign('h1', 'Добавление поставщика');
$ii = count($GLOBALS['IERA_LINKS']);
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Пользователи";
$GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/users/';
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Добавление поставщика";
if (isset($_POST['smb'])) {
    require_once $GLOBALS['PATH_block'] . 't_fnc.php';
    // для ф-ции проверки формы
    list($err, $errm) = Supplier_form_validate();
    if (!$err) {
        if ($id = $Supplier->AddSupplier($_POST)) {
            $tpl->Assign('msg', 'Поставщик добавлен.');
            unset($_POST);
        } else {
            $tpl->Assign('msg', 'Поставщик не добавлен.');
            if ($Supplier->db->errno == 1062) {
                $errm['email'] = "Такой email уже есть в базе.";
                $tpl->Assign('errm', $errm);
            }
        }
    } else {
        // показываем все заново но с сообщениями об ошибках
        $tpl->Assign('msg', 'Поставщик не добавлен!');
Пример #16
0
 public function ExecuteContragentOrder($arr, $id_order)
 {
     $Supplier = new Suppliers();
     $sql = "SELECT id_product, site_price_opt, site_price_mopt\r\n\t\t\tFROM " . _DB_PREFIX_ . "osp\r\n\t\t\tWHERE id_order = " . $id_order;
     $prices = $this->db->GetArray($sql, "id_product");
     if (isset($arr['contr_qty'])) {
         foreach ($arr['contr_qty'] as $id_product => $contr_qty) {
             $sql = "UPDATE " . _DB_PREFIX_ . "osp\r\n\t\t\t\t\tSET contragent_qty = " . $contr_qty . ",\r\n\t\t\t\t\t\tcontragent_sum = " . round($arr['contr_qty'][$id_product] * $prices[$id_product]['site_price_opt'], 2) . ",\r\n\t\t\t\t\t\tid_supplier = {$Supplier->GetSupplierIdByArt($arr['article'][$id_product])}\r\n\t\t\t\t\tWHERE id_order = " . $id_order . "\r\n\t\t\t\t\tAND id_product = " . $id_product;
             $this->db->StartTrans();
             if (!$this->db->Query($sql)) {
                 $this->db->FailTrans();
                 G::DieLoger("SQL error - {$sql}");
                 return false;
             }
             $this->db->CompleteTrans();
         }
     }
     if (isset($arr['contr_mqty'])) {
         foreach ($arr['contr_mqty'] as $id_product => $contr_mqty) {
             $sql = "UPDATE " . _DB_PREFIX_ . "osp\r\n\t\t\t\t\tSET contragent_mqty = " . $contr_mqty . ",\r\n\t\t\t\t\t\tcontragent_msum = " . round($arr['contr_mqty'][$id_product] * $prices[$id_product]['site_price_mopt'], 2) . ",\r\n\t\t\t\t\t\tid_supplier_mopt = {$Supplier->GetSupplierIdByArt($arr['article_mopt'][$id_product])}\r\n\t\t\t\t\tWHERE id_order = " . $id_order . "\r\n\t\t\t\t\tAND id_product = " . $id_product;
             $this->db->StartTrans();
             if (!$this->db->Query($sql)) {
                 $this->db->FailTrans();
                 G::DieLoger("SQL error - {$sql}");
                 return false;
             }
             $this->db->CompleteTrans();
         }
     }
     $sql = "UPDATE " . _DB_PREFIX_ . "order\r\n\t\t\tSET id_order_status = 2\r\n\t\t\tWHERE id_order = " . $id_order;
     $this->db->StartTrans();
     if (!$this->db->Query($sql)) {
         $this->db->FailTrans();
         G::DieLoger("SQL error - {$sql}");
         return false;
     }
     $this->db->CompleteTrans();
     return true;
 }
Пример #17
0
$Page = new Page();
$Page->PagesList();
$tpl->Assign('list_menu', $Page->list);
unset($parsed_res);
$User = new Users();
$User->SetUser($_SESSION['member']);
if ($User->fields['gid'] != _ACL_ADMIN_) {
    echo "Доступ запрещен.";
    exit(0);
}
if (!isset($GLOBALS['REQAR'][1]) && !is_numeric($GLOBALS['REQAR'][1])) {
    header('Location: /404/');
    exit(0);
}
$id_supplier = $GLOBALS['REQAR'][1];
$Supplier = new Suppliers();
$Supplier->SetFieldsById($id_supplier);
$tpl->Assign("supplier", $Supplier->fields);
if (!count($Supplier->fields)) {
    header('Location: /404/');
    exit(0);
}
$Products = new Products();
$Products->SetProductsList(array('a.id_supplier' => $Supplier->fields['id_user'], 'p.visible' => 1), '', array('GROUP_BY' => 'p.id_product'));
$Products->FillAssort($id_supplier);
$tpl->Assign('list', $Products->list);
$Products->SetExclusivList($id_supplier);
$tpl->Assign('exclusiv_list', $Products->list);
$tpl->Assign('id_supplier', $id_supplier);
if (!isset($_POST['smb'])) {
    foreach ($Supplier->fields as $k => $v) {
Пример #18
0
if (!isset($GLOBALS['REQAR'][1]) && !is_numeric($GLOBALS['REQAR'][1]) && !isset($GLOBALS['REQAR'][2]) && !isset($_POST['orders'])) {
    header('Location: ' . _base_url . '/404/');
    exit;
}
if (isset($_POST['orders']) || isset($_GET['orders'])) {
    if (isset($_GET['orders'])) {
        $orders = $_GET['orders'];
        // Получаем id контрагента
        isset($_GET['filial']) ? $filial = $_GET['filial'] : null;
    } else {
        $orders = $_POST['orders'];
        //Сюда приходит список всех задействованых заказов
    }
    unset($parsed_res);
    require $GLOBALS['PATH_model'] . 'invoice_c.php';
    $Supplier = new Suppliers();
    if (isset($filial) == true) {
        $tpl->Assign('filial', $Supplier->GetFilialById($filial));
    }
    $products = array();
    foreach ($orders as $id_order) {
        $Orders = new Orders();
        $Orders->SetFieldsById($id_order);
        $ord = $Orders->fields;
        $tpl->Assign("order", $ord);
        $Invoice = new Invoice();
        $User = new Users();
        // Получить данные покупателя
        $id_customer = $ord['id_customer'];
        $Customer = new Customers();
        $Customer->SetFieldsById($id_customer);
		<?php 
echo $form->textField($model, 'net_cost', array('disabled' => 'disabled'));
?>
		<?php 
echo $form->error($model, 'net_cost');
?>
		</td>
	</tr>
	<tr>
		<td>		
		<?php 
echo $form->labelEx($model, 'suppliers_id');
?>
		<?php 
$supplier_id = $model->suppliers_id;
$supplierModel = Suppliers::model()->findByPk($supplier_id);
if ($supplierModel) {
    echo $form->textField($supplierModel, 'name', array('disabled' => 'disabled'));
} else {
    echo "supplier not found";
}
?>
		<?php 
//echo $form->textField($model,'supplier_name', array('disabled'=>'disabled'));
?>
		<?php 
echo $form->error($model, 'suppliers_id');
?>
		</td>
		<td>
			<b><?php 
Пример #20
0
<?php

if (!_acl::isAllow('product_moderation')) {
    die("Access denied");
}
unset($parsed_res);
$dbtree = new dbtree(_DB_PREFIX_ . 'category', 'category', $db);
$Products = new Products();
$suppliers = new Suppliers();
$tpl->Assign('h1', 'Товары на модерации');
$ii = count($GLOBALS['IERA_LINKS']);
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Товары на модерации";
$prods = $Products->GetProductsOnModeration();
$list = $suppl = array();
foreach ($prods as $prod) {
    if ($prod['moderation_status'] != 2) {
        $suppliers->SetFieldsById($prod['id_supplier']);
        $suppl[$prod['id_supplier']] = $suppliers->fields;
        $list[$prod['id_supplier']][] = $prod;
    }
}
// Формирование списка категорий для выпадающего списка
$category = $Products->generateCategory();
$tpl->Assign('category', $category);
$tpl->Assign('list', $list);
$tpl->Assign('suppliers', $suppl);
$tpl_center .= $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_moderation.tpl');

			<section class="padd-tb-60 bg-dark image-v2 bg-fixed">

				<div class="container">

					<div class="row">

						<div class="col-md-4 col-md-offset-4">
							<div class="panel panel-default">
								<div class="panel-heading">
									<h3 class="panel-title">Product Details</h3>
								</div>
								<div class="panel-body">
									<?php 
$supplier = Suppliers::find($product->supplierId);
$category = Categories::find($product->categoryId);
?>
									<p>Product ID: {{$product->supplierProductId}}</p>
									<p>Name: {{$product->name}}</p>
									<p>Supplier: {{$supplier->name}}</p>
									<p>Category: {{$category->name}}</p>
									<p>Cost: {{$product->unitPrice}}</p>
									<p>Quantity:  {{$product->quantity}}<br></p>
									<p>Color is: {{$product->color}}</p>
									<p>Description is: {{$product->details}}</p>

									<div class="padd-t-20">
											<a class="btn btn-small btn-green" href="{{ URL::to('suppliers/' . $product->id . '/edit') }}">Edit</a>
											{{ Form::open(array('url' => 'products/' . $product->id, 'class' => 'pull-right')) }}
            								{{ Form::hidden('_method', 'DELETE') }}
Пример #22
0
     echo json_encode($Segmentation->GetSegmentation($_POST['type']));
     break;
 case 'removeSupplierAssort':
     if (!$Products->deleteSupplierAssort($_POST['id_assort'])) {
         return false;
     }
     return true;
     break;
 case 'updateActiveAssort':
     if (!$Products->updateActiveAssort($_POST['id_assort'], $_POST['active'])) {
         return false;
     }
     return true;
     break;
 case 'addSupplier':
     $Suppliers = new Suppliers();
     $id_supplier = $Suppliers->GetSupplierIdByArt($_POST['article']);
     $Suppliers->SetFieldsByID($id_supplier);
     $_POST['product_limit'] = $_POST['active'] == 1 ? 10000000 : 0;
     if ($_POST['price_opt_otpusk'] == 0 && $_POST['price_mopt_otpusk'] == 0) {
         $_POST['product_limit'] = 0;
         $_POST['active'] = 0;
     }
     if ($_POST['inusd'] == 1) {
         $_POST['price_mopt_otpusk_usd'] = $_POST['price_mopt_otpusk'];
         $_POST['price_mopt_otpusk'] = $_POST['price_mopt_otpusk'] * $Suppliers->fields['currency_rate'];
         $_POST['price_opt_otpusk_usd'] = $_POST['price_opt_otpusk'];
         $_POST['price_opt_otpusk'] = $_POST['price_opt_otpusk'] * $Suppliers->fields['currency_rate'];
     } else {
         $_POST['price_mopt_otpusk_usd'] = $_POST['price_mopt_otpusk'] / $Suppliers->fields['currency_rate'];
         $_POST['price_opt_otpusk_usd'] = $_POST['price_opt_otpusk'] / $Suppliers->fields['currency_rate'];
Пример #23
0
 public function UpdateSinglePrice($id_user, $single_price, $price = false)
 {
     $f['single_price'] = $single_price;
     $this->db->StartTrans();
     if (!$this->db->Update(_DB_PREFIX_ . 'supplier', $f, "id_user = "******"id_supplier = " . $id_user))) {
             $this->db->FailTrans();
             return false;
         }
     }
     $this->db->CompleteTrans();
     if (isset($succesUpdate)) {
         $res = $this->GetAssortimentProductIds($id_user);
         $arr = array();
         foreach ($res as $v) {
             $arr[] = $v['id_product'];
         }
         $Products = new Products();
         if (!$Products->RecalcSitePrices($arr)) {
             return false;
         }
     }
     return true;
 }
Пример #24
0
<?php

$GLOBALS['IERA_LINKS'][] = array('title' => $header, 'url' => _base_url . '/cabinet/assortment/');
$Products = new Products();
$Supplier = new Suppliers();
$Order = new Orders();
$Unit = new Unit();
$supplier = $Supplier->SetFieldsById($_SESSION['member']['id_user']);
$check_sum = $Supplier->GetCheckSumSupplierProducts($Supplier->fields['id_user']);
$tpl->Assign("check_sum", $check_sum);
$tpl->Assign("supplier", $Supplier->fields);
//*********************************Заполнение рабочих дней
if (isset($GLOBALS['Rewrite'])) {
    $cabinet_page = $GLOBALS['Rewrite'];
    $tpl->Assign('cabinet_page', $cabinet_page);
} else {
    header('Location: ' . _base_url . '/cabinet/assortment/');
}
if (isset($cabinet_page) && $cabinet_page == "productsonmoderation") {
    $header = "Товары на модерации";
    $GLOBALS['IERA_LINKS'][] = array('title' => $header, 'url' => _base_url . '/cabinet/productsonmoderation/');
    $list = $Products->GetProductsOnModeration($_SESSION['member']['id_user']);
    $tpl->Assign('list', $list);
    $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'products_on_moderation.tpl'));
} elseif (isset($cabinet_page) && $cabinet_page == "promo_orders") {
    $header = "Заказы с промо-кодом";
    $GLOBALS['IERA_LINKS'][] = array('title' => $header, 'url' => _base_url . '/cabinet/promo_orders/');
    $orders = $Order->GetOrdersByPromoSupplier($_SESSION['member']['id_user']);
    $tpl->Assign('orders', $orders);
    $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'promo_orders.tpl'));
} elseif (isset($cabinet_page) && $cabinet_page == "promo_codes") {
Пример #25
0
<?php

if (!_acl::isAllow('users')) {
    die("Access denied");
}
$User = new Users();
$Supplier = new Suppliers();
// ---- center ----
unset($parsed_res);
if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) {
    $id_user = $GLOBALS['REQAR'][1];
} else {
    header('Location: ' . $GLOBALS['URL_base'] . '404/');
    exit;
}
$tpl->Assign('h1', 'Удаление поставщика склада');
$ii = count($GLOBALS['IERA_LINKS']);
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Пользователи";
$GLOBALS['IERA_LINKS'][$ii++]['url'] = $GLOBALS['URL_base'] . 'adm/users/';
$GLOBALS['IERA_LINKS'][$ii]['title'] = "Удаление поставщика склада";
if (!$Supplier->RemoveWarehouse($id_user)) {
    die('Ошибка при удалении поставщика склада.');
} else {
    header('Location: ' . $GLOBALS['URL_base'] . 'adm/warehouses/?success=true');
    exit;
}
$tpl->Assign('msg', 'Поставщик удален.');
$parsed_res = array('issuccess' => TRUE, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_message.tpl'));
if (TRUE == $parsed_res['issuccess']) {
    $tpl_center .= $parsed_res['html'];
}
											<thead>
												<tr>
													<th><h4>Name</h4></th>
													<th><h4>Cost</h4></th>
													<th><h4>Supplier</h4></th>
													<th><h4>Category</h4></th>
													<th><h4>Quantity</h4></th>
													<th><h4>Colour</h4></th>
													<th><h4>Status</h4></th>
												</tr>
											</thead>
											<tbody>							
												@foreach($products as $key => $value)
												<tr>
													<?php 
$supplier = Suppliers::find($value->supplierId);
$category = Categories::find($value->categoryId);
?>
													<td style="width:15%"><strong>{{ $value->name }}</strong></td>
													<td style="width:15%">{{ $value->unitPrice}}</td>
													<td style="width:15%">{{ $supplier->name}}</td>
													<td style="width:15%">{{ $category->name}}</td>
													<td style="width:15%">{{ $value->quantity}}</td>
													<td style="width:10%">{{ $value->color}}</td>
													<td style="width:5%"><a class="btn btn-small btn-blue" href="{{ URL::to('products/' . $value->id . '/details') }}">Details</a></td>
													<td style="width:5%"><a class="btn btn-small btn-green" href="{{ URL::to('products/' . $value->id . '/edit') }}">Edit</a></td>
													<td style="width:5%">
													{{ Form::open(array('url' => 'products/' . $value->id, 'class' => 'pull-right')) }}
                    									{{ Form::hidden('_method', 'DELETE') }}
                    									{{ Form::submit('Delete', array('class' => 'btn btn-danger', 'onclick' => 'return confirm("Are you sure you want to delete this product?")')) }}
                										{{ Form::close() }}
Пример #27
0
<?php

require_once '../../models/Suppliers.php';
$results = Suppliers::GetAll();
?>


<!DOCTYPE html>
<html lang="en">
	<?php 
include '../../inc/head.php';
?>
	<body>
		<div>
			<?php 
include '../../inc/nav.php';
?>

			<div id="content">
				<table class="table table-bordered table-condensed table-hover table-striped">
					<tr>
						<th>Supplier Id</th><th>Company Name</th><th>Actions</th>
					</tr>
					
					<?php 
while ($row = $results->fetch_assoc()) {
    ?>
						<tr>
							<td><?php 
    echo $row['SupplierId'];
    ?>
Пример #28
0
 public function AddPhotoProduct($data)
 {
     // try to create new product
     if (!($id_product = $this->AddProduct($data))) {
         return false;
     }
     $article = $this->GetArtByID($id_product);
     // try to add photos to the new product
     foreach ($data['images'] as $k => $image) {
         $to_resize[] = $newname = $article['art'] . ($k == 0 ? '' : '-' . $k) . '.jpg';
         $file = pathinfo($image['src']);
         $path = $GLOBALS['PATH_root'] . $file['dirname'] . '/';
         $bd_path = $file['dirname'];
         rename($path . $file['basename'], $path . $newname);
         $images_arr[] = $file['dirname'] . '/' . $newname;
         $visibility[] = $image['visible'] == 'true' ? 1 : 0;
     }
     //Проверяем ширину и высоту загруженных изображений, и если какой-либо из показателей выше 1000px, уменяьшаем размер
     foreach ($images_arr as $filename) {
         $size = getimagesize($GLOBALS['PATH_root'] . $filename);
         //Получаем ширину, высоту, тип картинки
         if ($size[0] > 1000 || $size[1] > 1000) {
             $ratio = $size[0] / $size[1];
             //коэфициент соотношения сторон
             //Определяем размеры нового изображения
             if (max($size[0], $size[1]) == $size[0]) {
                 $width = 1000;
                 $height = 1000 / $ratio;
             } elseif (max($size[0], $size[1]) == $size[1]) {
                 $width = 1000 * $ratio;
                 $height = 1000;
             }
         } else {
             $width = $size[0];
             $height = $size[1];
         }
         $res = imagecreatetruecolor($width, $height);
         imagefill($res, 0, 0, imagecolorallocate($res, 255, 255, 255));
         $src = $size['mime'] == 'image/jpeg' ? imagecreatefromjpeg($GLOBALS['PATH_root'] . $filename) : imagecreatefrompng($GLOBALS['PATH_root'] . $filename);
         imagecopyresampled($res, $src, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
         imagejpeg($res, $GLOBALS['PATH_root'] . $filename);
     }
     $Images = new Images();
     $Images->resize(false, $to_resize);
     $this->UpdatePhoto($id_product, $images_arr, $visibility);
     // try to add videos
     if (!empty($_POST['video'])) {
         $this->UpdateVideo($id_product, $_POST['video']);
     }
     // try to add new product to supplier's assort
     $Suppliers = new Suppliers();
     $id_supplier = $Suppliers->GetSupplierIdByArt($data['art_supplier']);
     if (!$this->AddToAssort($id_product, $id_supplier)) {
         return false;
     }
     // Добавление данных в таблицу photo_batch
     $date = date('Y-m-d');
     $id_author = $_SESSION['member']['id_user'];
     $id_batch = $this->GetIdPhotoBatch($date, $id_supplier, $id_author);
     if ($id_batch) {
         $this->AddPhotoBatchProducts($id_batch, $id_product);
     } else {
         $f['date'] = date('Y-m-d');
         $f['id_supplier'] = $id_supplier;
         $f['id_author'] = $id_author;
         $this->db->StartTrans();
         if (!$this->db->Insert(_DB_PREFIX_ . 'photo_batch', $f)) {
             $this->db->FailTrans();
             return false;
         }
         $this->db->CompleteTrans();
         $id_batch = $this->GetIdPhotoBatch($date, $id_supplier, $id_author);
         $this->AddPhotoBatchProducts($id_batch, $id_product);
     }
     return $id_product;
 }
Пример #29
0
						echo json_encode('ok');
					}
				}else{
					if($Specification->UpdateSpecsInProducts($_POST)){
						echo json_encode('ok');
					}
				}
				break;
			case 'update_translit':
				echo json_encode($Products->UpdateTranslit($_POST['id_product']));
				break;
			case 'datalist':
				echo json_encode($Products->GetIdOneRowArrayByArt($_POST['article']));
				break;
			case 'datalist_supplier':
				$Supplier = new Suppliers();
				echo json_encode($Supplier->GetIdOneRowArrayByArt($_POST['article']));
				break;
			case 'insert_related':
				echo json_encode($Products->AddRelatedProduct($_POST['id_prod'], $_POST['id_related_prod']));
				break;
			case 'remove_related':
				echo json_encode($Products->DelRelatedProduct($_POST['id_prod'], $_POST['id_related_prod']));
				break;
			case 'add_supplier':
				echo json_encode($Products->GetSupplierInfoByArticle($_POST['art']));
				break;
			case 'get_segment_list':
				$Segmentation = new Segmentation();
				echo json_encode($Segmentation->GetSegmentation($_POST['type']));
				break;
Пример #30
0
            <?php 
echo $form->error($model1, 'issue_date');
?>
        </div>


    </div>



    <div class="row">
        <?php 
echo $form->labelEx($model1, 'supplier_id');
?>
        <?php 
$this->widget('bootstrap.widgets.select2.ESelect2', array('model' => $model1, 'attribute' => 'supplier_id', 'data' => CHtml::listData(Suppliers::model()->findAll(), 'id', 'supplierName'), 'htmlOptions' => array('class' => '')));
?>
        <?php 
echo $form->error($model1, 'supplier_id');
?>
    </div>
    <br>
    <div id="form-content" style="margin-right: 5%;">
        <?php 
if ($mode === 'update') {
    foreach ($model2 as $indmodel) {
        $this->renderPartial('_form-purchases-info', array('form' => $form, 'model2' => $indmodel, 'sts' => $sts));
        $sts++;
    }
} else {
    $this->renderPartial('_form-purchases-info', array('form' => $form, 'model2' => $model2, 'sts' => 0));