示例#1
0
function search_product($searchTxt)
{
    include "products.php";
    $obj = new products();
    if ($obj->seachProducts($searchTxt)) {
    }
}
示例#2
0
 function showremscfrompgcatid()
 {
     $catlist = $this->getPGCategories();
     $prodcodes = new products();
     $prodcodelist = $prodcodes->getProductCodeList();
     display::header();
     pgdisplay::remfromcat($prodcodelist, $catlist);
 }
示例#3
0
 public static function main()
 {
     //odczytanie __CLASS__ nie moze byc w funkcji w klasie nadrzędnej
     if (basename($_SERVER["SCRIPT_NAME"]) == __CLASS__ . ".php") {
         products::display(__CLASS__);
     }
 }
示例#4
0
 public function __construct($recipe_id)
 {
     $this->_db = STOCK_DB::getInstance();
     $this->_user = new User();
     $ingredientUnit = $this->_db->join(array(array('table_name' => 'ProductRecipes', 'next_table_name' => 'Unit', 'table_column' => 'unit', 'next_table_column' => 'Name', 'selections' => array('*')), array('table_name' => 'Unit', 'next_table_name' => null, 'table_column' => null, 'next_table_column' => null, 'selections' => array('Ratio'))), true);
     //select distinct
     $this->_ingredients = $ingredientUnit->results();
     $recipeInfo = $this->toArray();
     //echo var_dump($recipeInfo);
     //die();
     $ingredients = array();
     foreach ($recipeInfo as $ingredient) {
         $products = new products();
         $product = $products->findProduct($ingredient['Products_id']);
         $product = $this->_db->get('Products', ['id', '=', $ingredient['Products_id']])->results();
         $product = json_decode(json_encode($product), true);
         $product = $product[0];
         //remove unneccesary fields
         unset($product['user']);
         unset($product['Suppliers_id']);
         unset($product['purchaseUnitPrice']);
         unset($product['user']);
         unset($product['purchaseUnitWeight']);
         unset($product['purchaseUnit']);
         unset($product['discount']);
         unset($product['density']);
         //append ProductRecipes fields
         $product['quantity'] = $ingredient['quantity'];
         $product['Ratio'] = $ingredient['Ratio'];
         //replace the unitName with ProductRecipes unit
         $product['unitName'] = $ingredient['unit'];
         array_push($ingredients, $product);
         /* final $product:
         				id - from Products
         				productName - from Products
         				yeild - from Products
         				costPerKiloUnit - from Products
         				unitName - from ProductRecipes
         				quantity - from ProductRecipes
         				Ratio - from Unit
         			*/
     }
     $this->_ingredients = $ingredients;
     return $this;
 }
示例#5
0
 /**
  * Deletes all products associated with this category prior to deleting the category
  * @see testProjectModel::beforeDelete()
  */
 public function beforeDelete()
 {
     $products = products::model()->getAll();
     foreach ($products as $product) {
         if ($product->category->id == $this->id) {
             $product->delete();
         }
     }
     return true;
 }
 public function edit()
 {
     $products = new products();
     $idr = $_GET['id'];
     if ($_POST) {
         if ($products->editProduct($_POST['keyP'], $_POST['name'], $_POST['amount'], $_POST['value'], $_POST['id'])) {
             $this->success = true;
             $this->msg = "Produto editado com sucesso!";
         } else {
             $this->success = false;
             $this->msg = "Erro ao editar o produto, por favor, tente novamente mais tarde!";
         }
     }
     $data = $products->getProduct($idr);
     $name = $data->name;
     $amount = $data->amount;
     $value = $data->value;
     $id = $data->id;
     $keyP = $data->keyP;
     $success = $this->success;
     $msg = $this->msg;
     require_once 'view/product_edit_view.php';
 }
示例#7
0
 public function productsAction()
 {
     $ns = new Zend_Session_Namespace();
     $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><shineisp></shineisp>');
     $localeID = $ns->idlang;
     $products = $xml->addChild('products');
     try {
         // Get all the products
         $records = Products::getAll(null, $localeID);
         if (!empty($records)) {
             foreach ($records as $item) {
                 $item['ProductsData'][0]['shortdescription'] = strip_tags($item['ProductsData'][0]['shortdescription']);
                 $item['ProductsData'][0]['description'] = strip_tags($item['ProductsData'][0]['description']);
                 $item['ProductsData'][0]['shortdescription'] = html_entity_decode($item['ProductsData'][0]['shortdescription'], ENT_NOQUOTES, "UTF-8");
                 $item['ProductsData'][0]['description'] = html_entity_decode($item['ProductsData'][0]['description'], ENT_NOQUOTES, "UTF-8");
                 $item['ProductsData'][0]['shortdescription'] = str_replace("&", "", $item['ProductsData'][0]['shortdescription']);
                 $item['ProductsData'][0]['description'] = str_replace("&", "", $item['ProductsData'][0]['description']);
                 $categories = products::get_text_categories($item['categories']);
                 $categories = htmlspecialchars($categories);
                 $product = $products->addChild('product');
                 $product->addAttribute('uuid', $item['uuid']);
                 $product->addAttribute('id', $item['product_id']);
                 $product->addAttribute('inserted_at', !empty($item['inserted_at']) ? strtotime($item['inserted_at']) : null);
                 $product->addAttribute('updated_at', !empty($item['updated_at']) ? strtotime($item['updated_at']) : null);
                 $product->addChild('sku', htmlentities($item['sku']));
                 if (!empty($item['ProductsMedia'][0]['path']) && file_exists(PUBLIC_PATH . $item['ProductsMedia'][0]['path'])) {
                     $product->addChild('image', "http://" . $_SERVER['HTTP_HOST'] . $item['ProductsMedia'][0]['path']);
                 }
                 $product->addChild('name', !empty($item['ProductsData'][0]['name']) ? $item['ProductsData'][0]['name'] : null);
                 $product->addChild('shortdescription', !empty($item['ProductsData'][0]['shortdescription']) ? "<![CDATA[" . $item['ProductsData'][0]['shortdescription'] . "]]>" : null);
                 $product->addChild('description', !empty($item['ProductsData'][0]['description']) ? "<![CDATA[" . $item['ProductsData'][0]['description'] . "]]>" : null);
                 $product->addChild('categories', $categories);
                 $price = $product->addChild('price', Products::getPrice($item['product_id']));
                 $price->addAttribute('taxincluded', 0);
                 $price->addAttribute('isrecurrent', products::isRecurring($item['product_id']));
                 $price->addAttribute('currency', Settings::findbyParam('currency'));
             }
         }
         header('Content-Type: text/xml; charset=utf-8');
         die($xml->asXML());
     } catch (Exception $e) {
         Shineisp_Commons_Utilities::log(__CLASS__ . " " . $e->getMessage());
         die;
     }
 }
 public function index()
 {
     $user = new user();
     $product = new products();
     $totalUsers = $user->getUsersCount();
     $totalProducts = $product->getProductsCount();
     $lastUser = $user->getLastUser()->name;
     $product->getAllProducts();
     $lastProduct = $product->getLastProduct()->name;
     $totalProductsValue = $product->totalValue();
     $totalProductsAmount = $product->totalAmount();
     require_once 'view/index_view.php';
 }
示例#9
0
文件: index.php 项目: Mayyad/Tigers
<?php

ob_start();
session_start();
function __autoload($name)
{
    include_once "files/" . $name . ".php";
}
$orders = new orders();
$rooms = new rooms();
$products = new products();
$validate = new validation();
if (isset($_SESSION['cafeteriaSystem'])) {
    ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Cafeteria System | Home Page</title>
	<link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/css.css" rel="stylesheet">
    
    
	
    <style>
		body{
			margin-top:10px ;	
		}
示例#10
0
<?php

ob_start();
session_start();
function __autoload($name)
{
    include_once "files/" . $name . ".php";
}
$products = new products();
$rooms = new rooms();
$validate = new validation();
if (isset($_SESSION['cafeteriaSystem'])) {
    if ($_SESSION['type'] != '1') {
        header("location:index.php");
    }
    ?>

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
   <title>Cafeteria System | My Products</title>
	<link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/css.css" rel="stylesheet">
    
    
	
    <style>
		body{
示例#11
0
         exit;
         break;
     case "stat":
         $tpl_file = "tradestat";
         $amount = $trade->findAll("Trade.type_id AS TradeTypeId,COUNT(Trade.id) AS CountTrade", null, $conditions, "Trade.type_id", 0, 10, "Trade.type_id");
         foreach ($amount as $val) {
             $stats[$val['TradeTypeId']] = $val['CountTrade'];
         }
         setvar("UserTradeStat", $stats);
         setvar("ProductAmount", $product->findCount(null, $conditions, "Product.id"));
         break;
     default:
         break;
 }
 if ($do == "pro2offer" && !empty($_GET['productid'])) {
     $product = new products();
     $item = $product->read("*", $_GET['productid'], null, "member_id=" . $the_memberid);
     $item['country'] = "blank.gif";
     $trade_types = $trade->GetArray("SELECT * FROM " . $tb_prefix . "tradetypes");
     foreach ($trade_types as $key => $val) {
         if ($val['parent_id'] == 0) {
             $set_types[$val['id']] = $val;
             foreach ($trade_types as $key1 => $val1) {
                 if ($val1['parent_id'] == $val['id']) {
                     $set_types[$val['id']]['child'][$val1['id']] = $val1;
                 }
             }
         }
     }
     setvar("select_tradetypes", $set_types);
     if (!empty($item)) {
<form name="frmCategory" method="post">
<input name="txt_name" type="hidden">
<input name="task" type="hidden">
<input name="close_win" type="hidden">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr class="TableHead2" height="20">
		<td align="center" width="20"> # </td>
		<td width="40%" nowrap><?php 
echo $sc_category_name;
?>
 </td>
		<td></td>
	</tr>
<?php 
$pro2 = new products();
if ($pro->num_rows() > 0) {
    $pro->seek();
}
$i = 0;
while ($pro->next_record()) {
    $id = $pro->f('category_id');
    $name = $pro->f('category_name');
    $pro2->get_categories($pro->f('category_id'));
    $count = $pro2->num_rows();
    $click_del = "javascript:click_del(document.frmCategory, {$id} , \"{$name}\" , \"" . sprintf($count == 0 ? $sc_ConfirmDeleteCategory2 : $sc_ConfirmDeleteCategory, $name) . "\")";
    //			<a href="<?php echo "javascript:set_edit(document.frmCategory,'$id','$name',0,'$count')"  ">
    ?>
	
	<tr class="HiLi">
		<td align="center"> <?php 
示例#13
0
$cc = '';
$fax = $order['fax'];
$tel = $order['phone'];
$subj = '';
$effective = $order['sale_date'];
$quotation = $order['valid_date'];
$row_count = 0;
// initial value
while ($pro->next_record()) {
    $apid = $pro->f('product_id');
    $acate = $pro->f('attach_cate_id');
    $order_attach_arr[$apid . $acate] = $pro->f('attach_id');
    $order_price_arr[$apid . $acate] = $pro->f('price');
    $order_quantity_arr[$apid . $acate] = $pro->f('quantity');
}
$pro_order = new products();
$list_id = $pro_order->get_order_productid_list($order_id);
$pro_order->get_buy_products($list_id);
$i = 0;
$ptotal = 0;
$attach_cate = new products();
$attach = new products();
while ($pro_order->next_record()) {
    // price
    $pprice = $pro_order->f('price');
    // product_id
    $pid = $pro_order->f('product_id');
    // attachment_id
    $apid = $pid;
    // product name
    $pname = $pro_order->f('product_name');
示例#14
0
<a href="products.php">products.php</a><br>
<a href="customers.php">customers.php</a><br>
<a href="transactions.php">transactions.php</a><br>
<a href="login.php">login.php</a><br>

<?php 
/* http://pl.php.net/manual/en/function.mysqli-connect.php
http://www.devshed.com/c/a/MySQL/Implementing-Additional-Methods-with-mysqli-and-PHP-5/1/
(013147149X_book.pdf) Andi Gutmans, Stig S??her Bakken
and Derick Rethans - PHP 5 Power Programming -> 6.2.6 Queries
*/
require_once 'functions.php';
products::display();
customers::display();
transactions::display();
login::display();
database::getConn()->close();
	  </tr>
	  <tr>
    	<td width="1%" align="right" nowrap><?php 
echo $sc_warranty;
?>
 : &nbsp;</td>
	    <td><textarea name="warranty" style="height:70;width:50%"><?php 
echo $warranty;
?>
</textarea></td>
	  </tr>

<?php 
$choice = new choice_list();
if (!$is_attachment) {
    $pro2 = new products();
    $pro2->get_attach_categories($category_id, true);
    while ($pro2->next_record()) {
        ?>
	  <tr>
	  	<td width="1%" align="right" nowrap><?php 
        echo $pro2->f('name');
        ?>
 : &nbsp;</td>
		<td>
<?php 
        $choice->clear();
        $cate_id = $pro2->f('id');
        $pro->get_attachments($cate_id);
        while ($pro->next_record()) {
            if (isset($list_attach[$cate_id])) {
示例#16
0
    $data = json_decode($json);
    $message = $data->message;
    $response = array();
    global $user_id;
    $db = new messages();
    $res = $db->updateMessage($message);
    if ($res != NULL) {
        echo json_encode(array('error' => false, 'message' => 'Mensaje actualizado satisfactoriamente'));
    } else {
        echo json_encode(array('error' => true, 'message' => 'Error en la actualizacion del mensaje. Por favor intente de nuevo'));
    }
});
$app->put('/position', 'authenticate', function () use($app) {
    $json = $app->request->getBody();
    $data = json_decode($json);
    $id1 = $data->id1;
    $id2 = $data->id2;
    $response = array();
    global $user_id;
    $db = new products();
    $res = $db->change_position($id1, $id2);
    if ($res != NULL) {
        echo json_encode(array('error' => false, 'message' => 'Posiciones actualizadas satisfactoriamente'));
    } else {
        echo json_encode(array('error' => true, 'message' => 'Error en el cambio de posicion. Por favor intente de nuevo'));
    }
});
$app->map('/:x+', function ($x) {
    http_response_code(200);
})->via('OPTIONS');
$app->run();
示例#17
0
$first = $max_rows * ($curpage - 1);
//	alert($_GET['curpage']);
if (!isset($_SESSION['cart'])) {
    $_SESSION['cart'] = new Cart('product_id', 'price', 'sc_products');
}
$trash = '<img src="' . $GO_THEME->images['delete'] . '" border="0">';
$spliter = '<tr><td colspan="100" height="1"><img src="' . $GO_THEME->images['cccccc'] . '" border="0" height="1" width="100%" /></td></tr>';
$image['mlastnode'] = '<img src="' . $GO_THEME->images['mlastnode'] . '" border="0" height="22" width="16" align="absmiddle" />';
$image['emptylastnode'] = '<img src="' . $GO_THEME->images['emptylastnode'] . '" border="0" height="22" width="16" align="absmiddle" />';
$image['plastnode'] = '<img src="' . $GO_THEME->images['plastnode'] . '" border="0" height="22" width="16" align="absmiddle" />';
$image['mnode'] = '<img src="' . $GO_THEME->images['mnode'] . '" border="0" height="22" width="16" align="absmiddle" />';
$image['emptynode'] = '<img src="' . $GO_THEME->images['emptynode'] . '" border="0" height="22" width="16" align="absmiddle" />';
$image['pnode'] = '<img src="' . $GO_THEME->images['pnode'] . '" border="0" height="22" width="16" align="absmiddle" />';
$image['vertline'] = '<img src="' . $GO_THEME->images['vertline'] . '" border="0" height="22" width="16" align="absmiddle" />';
$image['blank'] = '<img src="' . $GO_THEME->images['blank'] . '" border="0" height="22" width="16" align="absmiddle" />';
$pro = new products();
$exp = $_SESSION['exp'];
$task = $_REQUEST['task'];
switch ($task) {
    case 'update':
        $id = $_POST['id'];
        $name = $_POST['product'];
        $category_id = $_POST['category_id'];
        $is_attachment = $_POST['is_attach'];
        $price = $_POST['price'];
        $description = $_POST['description'];
        $warranty = $_POST['warranty'];
        $part_number = $_POST['part_number'];
        $VAT = $_POST['VAT'];
        $cate = $_POST['attachment_categories'];
        for ($i = 0; $i < count($cate); $i++) {
 function view($id, $tpl)
 {
     /*
     	Cosas que faltan por hacer:
     		De forma general, mirar los permisos del usuario que vaya a acceder aqui, para saber si tiene permisos de borrar editar ver etc...
     		Averiguar como pasar el numero de registros, si va a ser a grupos a grupos, si va a ser a modulos, a modulos
     		Order By (y mantener la búsqueda en el caso de que hubiera hecha una y averiguar la "pestaña" a la que hace referencia)
     		Busquedas
     */
     $cadena = '';
     // Leemos la empresa y se lo pasamos a la plantilla
     $this->read($id);
     $tpl->assign('objeto', $this);
     //listado de empleados
     $tabla_empleados = new table(false);
     $empleados = new emps();
     if ($empleados->get_list_emps($_SESSION['ident_corp']) == 0) {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_empleados->tabla_vacia('emps', $per->add);
         $variables_empleados = $tabla_empleados->nombres_variables;
     } else {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_empleados->make_tables('emps', $empleados->emps_list, array('Nombre', 20, 'Primer Apellido', 20, 'Segundo Apellido', 20), array('id_emp', 'name', 'last_name', 'last_name2'), $_SESSION['num_regs'], $per->permissions_module, $per->add);
         $variables_empleados = $tabla_empleados->nombres_variables;
     }
     //Productos
     $products = new products(false);
     $tabla_productos = new table(false);
     if ($products->get_list_products_corps($_SESSION['ident_corp']) == 0) {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_productos->tabla_vacia('products', $per->add);
         $variables_products = $tabla_productos->nombres_variables;
     } else {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_productos->make_tables('products', $products->products_list, array('Nombre', 20, 'Nombre Web', 40), array('id_product', 'name', 'name_web'), $_SESSION['num_regs'], $per->permissions_module, $per->add);
         $variables_products = $tabla_productos->nombres_variables;
     }
     //servicios
     $services = new services(false);
     $tabla_servicios = new table(false);
     if ($services->get_list_services_corp($_SESSION['ident_corp']) == 0) {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_servicios->tabla_vacia('services', $per->add);
         $variables_services = $tabla_servicios->nombres_variables;
     } else {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_servicios->make_tables('services', $services->services_list, array('Nombre', 20, 'Nombre Web', 40), array('id_service', 'name', 'name_web'), $_SESSION['num_regs'], $per->permissions_module, $per->add);
         $variables_services = $tabla_servicios->nombres_variables;
     }
     //clientes
     $clients = new clients(false);
     $tabla_clientes = new table(false);
     if ($clients->get_list_clients($_SESSION['ident_corp']) == 0) {
         $per = new permissions();
         $per->get_permissions_list('clients');
         $cadena = $cadena . $tabla_clientes->tabla_vacia('clients', $per->add);
         $variables_clients = $tabla_clientes->nombres_variables;
     } else {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_clientes->make_tables('clients', $clients->clients_list, array('Nombre', 20, 'Nombre Completo', 40, 'Tel&eacute;fono', 20), array('id_client', 'name', 'full_name', 'phone'), 10, $per->permissions_module, $per->add);
         $variables_clients = $tabla_clientes->nombres_variables;
     }
     //Rellenamos de forma provisional las variables con un "no se puede mostrar"
     $facturaspen = new table(false);
     $facturascob = new table(false);
     $gestionalm = new table(false);
     $partes = new table(false);
     $cadena = $cadena . $facturaspen->dont_show('facturaspen');
     $cadena = $cadena . $facturascob->dont_show('facturascob');
     $cadena = $cadena . $gestionalm->dont_show('gestionalm');
     $cadena = $cadena . $partes->dont_show('partes');
     $variables_facturaspen = $facturaspen->nombres_variables;
     $variables_facturascob = $facturascobs->nombres_variables;
     $variables_gestionalm = $gestionalm->nombres_variables;
     $variables_partes = $partes->nombres_variables;
     $i = 0;
     while ($i < count($variables_empleados) + count($variables_clients) + count($variables_facturaspen) + count($variables_facturascob) + count($variables_products) + count($variables_services) + count($variables_gestionalm) + count($variables_partes)) {
         for ($j = 0; $j < count($variables_empleados); $j++) {
             $variables[$i] = $variables_empleados[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_clients); $j++) {
             $variables[$i] = $variables_clients[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_facturaspen); $j++) {
             $variables[$i] = $variables_facturaspen[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_facturascob); $j++) {
             $variables[$i] = $variables_facturascob[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_products); $j++) {
             $variables[$i] = $variables_products[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_services); $j++) {
             $variables[$i] = $variables_services[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_gestionalm); $j++) {
             $variables[$i] = $variables_gestionalm[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_partes); $j++) {
             $variables[$i] = $variables_partes[$j];
             $i++;
         }
     }
     //Se comprueba si hay permiso para borrar o modificar
     $permisos_mod_del = new permissions();
     $permisos_mod_del->get_permissions_modify_delete('corps');
     $tpl->assign('acciones', $permisos_mod_del->per_mod_del);
     $tpl->assign('variables', $variables);
     $tpl->assign('cadena', $cadena);
     //
     return $tpl;
 }
示例#19
0
 /**
  * Deletes a product
  * 
  * If no product ID is passed or if it does not match a valid product ID in the database, an error
  * message is generated.  Otherwise the product is deleted and a success message is generated.  In either
  * case the user is redirected to the products index.
  */
 public function actionDelete()
 {
     testProject::setAlert('There was a problem with your request.  Please try again.', 'error');
     if (isset($_GET['value'])) {
         //check if ID is provided
         $model = products::model()->getByPK($_GET['value']);
         $name = $model->name;
         if ($model->delete()) {
             //attempt to delete the item
             testProject::setAlert('The item ' . $name . ' was deleted.', 'info');
         }
     }
     $this->redirect('products/index');
 }
示例#20
0
<script type="text/javascript" src="js/jquery-1.12.0.min.js"></script>
<script type="text/javascript" src="js/scripts.js"></script>
<?php 
session_start();
require_once "../files/products.php";
require_once "../files/validation.php";
require_once "../files/rooms.php";
require_once "../files/orders.php";
$products = new products();
$validate = new validation();
$rooms = new rooms();
$orders = new orders();
//$mystr=$_POST['msg'];
//echo $mystr;
//Hena ana hab3at ll method al id Session
/*
	
	echo date("Y-m-d");
	echo "<br>".date("h : i : A");*/
$totalAmount = 0;
if ($_POST['isNullProduct'] == "1") {
    if ($validate->checkNotNull($_POST['roomNo'])) {
        if ($rooms->checkRoomNumById($_POST['roomNo']) or $_POST['roomNo'] == "0") {
            if ($returnRow = $orders->insertCheck($_POST['userID'], $_POST['roomNo'], $_POST['orderNotice'])) {
                foreach ($_POST as $key => $value) {
                    if (is_numeric($key)) {
                        if ($products->returnProductInfo($key)) {
                            $productInfo = mysqli_fetch_array($products->returnProductInfo($key));
                            //echo "Found" . $productInfo['name'];
                            if ($productInfo['status'] == "1") {
                                $sum = $value * $productInfo['price'];
示例#21
0
 |                                                                         |
 +-------------------------------------------------------------------------+
*/
include "../../include/session.php";
include "include/tables.php";
include "include/fields.php";
include "include/products.php";
if (!isset($_GET["backurl"])) {
    $backurl = NULL;
} else {
    $backurl = $_GET["backurl"];
    if (isset($_GET["refid"])) {
        $backurl .= "?refid=" . $_GET["refid"];
    }
}
$thetable = new products($db, "tbld:7a9e87ed-d165-c4a4-d9b9-0a4adc3c5a34", $backurl);
$therecord = $thetable->processAddEditPage();
if (isset($therecord["phpbmsStatus"])) {
    $statusmessage = $therecord["phpbmsStatus"];
}
$pageTitle = "Product";
$phpbms->cssIncludes[] = "pages/products.css";
$phpbms->jsIncludes[] = "modules/bms/javascript/product.js";
//Form Elements
//==============================================================
$theform = new phpbmsForm();
$theform->enctype = "multipart/form-data";
$theinput = new inputCheckbox("inactive", $therecord["inactive"]);
$theform->addField($theinput);
$theinput = new inputCheckbox("taxable", $therecord["taxable"]);
$theform->addField($theinput);
示例#22
0
文件: hello.php 项目: Wainaina3/pos
function getProdsByManufacs()
{
    if (!isset($_REQUEST['manf'])) {
        //return error
        echo '{"result":0,"message": "search did not work."}';
    }
    $search_text = $_REQUEST['manf'];
    include "products.php";
    $obj = new products();
    if (!$obj->searchByManfs($search_text)) {
        //return error
        echo '{"result":0,"message": "search did not work."}';
        return;
    }
    //at this point the search has been successful.
    //generate the JSON message to echo to the browser
    $row = $obj->fetch();
    echo '{"result":1,"products":[';
    //start of json object
    while ($row) {
        echo json_encode($row);
        //convert the result array to json object
        $row = $obj->fetch();
        if ($row) {
            echo ",";
            //if there are more rows, add comma
        }
    }
    echo "]}";
    //end of json array and object
}
示例#23
0
 function updateProduct()
 {
     include_once "products.php";
     $product = new products();
     $fid = $_REQUEST['fid'];
     $fname = $_REQUEST['fname'];
     $fcateg = $_REQUEST['fcateg'];
     $fprice = $_REQUEST['fprice'];
     $pic = $_REQUEST['pic'];
     if (!$product->updateProduct($fid, $fname, $fcateg, $fprice, $pic)) {
         echo '{"result":0,"message":"Could not add the product"}';
         return;
     }
     echo '{"result":1,"message":"Succesfully added product"}';
 }
示例#24
0
                $cfg = new sc_configuration($cfgset);
                $cfg->setAll();
                $mainframe->redirect("index.php?option=com_caddy&action=configuration&task=show", JText::_("Configuration saved"));
            case "cancel":
                $mainframe->redirect("index.php?option=com_caddy&action=configuration&task=show", JText::_("Reverting to previous Configuration"));
            default:
                $cfgset = JRequest::getvar('cfgset');
                JRequest::setvar('task', "configuration");
                $cfg = new sc_configuration($cfgset);
                display::header();
                $cfg->show();
                break;
        }
        break;
    case "view_prod":
        $a = new products();
        $alist = $a->getPublishedProducts();
        display::view_prod($alist);
        break;
    case "about":
        switch ($task) {
            default:
                JRequest::setvar('task', "about");
                display::ShowAbout();
                break;
        }
        break;
    default:
        JRequest::setvar('task', "control");
        display::MainMenu();
}
示例#25
0
<?php

session_start();
require_once "../files/products.php";
$word = $_POST['word'];
$products = new products();
//echo "aaaaaaaaaaaaaaa";
if ($products->checkAvailableProducts()) {
    $products->viewavAilableProductsBySearch($word);
}
示例#26
0
<?php

$preload_files = 'modules/products/classes/products.class.php';
require "../../Group-Office.php";
require '../../lib/tkdlib.php';
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('products');
require $GO_LANGUAGE->get_language_file('products');
require $GO_THEME->theme_path . "header.inc";
$pro = new products();
$choice = new choice_list();
switch ($_REQUEST['task']) {
    case 'update':
        $i = (int) $pro->update_category($_POST['id'], $_POST['category'], $_POST['parent_id'], $_POST['template_id']);
        if ($i == $pro->err_duplicate) {
            alert(sprintf($sc_Duplicate, $sc_category));
        }
        if ($i == $pro->err_child_of_itsself) {
            alert($sc_ChildOfItsself);
        }
        break;
    case 'add':
        if ((int) $pro->add_category($_POST['category'], $_POST['parent_id'], $_POST['template_id']) == $pro->err_duplicate) {
            alert(sprintf($sc_Duplicate, $sc_category));
        }
        break;
    case 'delete':
        if (!$pro->delete_category($_POST['id'])) {
            alert(sprintf($sc_CannotDelete, $_POST['txt_name']));
        }
        break;
示例#27
0
      </ul>
     
      </li>
         
    </ul>

    <!-- Left Nav Section -->
    <ul class="left">
      <li style="color:white;"><p style="position:absolute; top:10px;">
    </li>
    </ul>
</nav>

  
  <?php 
$p = new products();
$pid = $_GET['pid'];
$values = $p->selectByID($_GET['pid']);
?>

  <div class="row">
<ul class="small-block-grid-1 medium-block-grid-3 large-block-grid-1" style="margin-top:3vh;">
   <?php 
for ($i = 0; $i < count($values); $i++) {
    ?>

    <li >
     <ul class="pricing-table">
       <li class="title"> <p > <?php 
    echo $values[$i]['name'];
    ?>
</td>
	  <td align="center" width="1%" nowrap><?php 
echo $sc_VAT;
?>
</td>
	  <td align="center" width="1%" nowrap><?php 
echo $sc_sum;
?>
</td>
	  <td align="center" width="1%" nowrap>&nbsp;</td>
    </tr>
<?php 
$i = 0;
$ptotal = 0;
$attach_cate = new products();
$attach = new products();
while ($pro->next_record()) {
    $pprice = $pro->f('price');
    $pid = $pro->f('product_id');
    $pname = $pro->f('product_name');
    if ($task == 'new') {
        $pquantity = $pitems[$pid];
    } else {
        $pquantity = $pro->f('quantity');
    }
    $click_del = "javascript:click_delete(document.frmOrder, {$pid} , \"{$pname}\" , \"" . sprintf($sc_ConfirmDeleteProductFromCart, $pname) . "\", \"_cart\")";
    ?>
    <tr>
      <td align="center"> <?php 
    echo ++$i;
    ?>
示例#29
0
 public function actionUpdateProduct()
 {
     $errors = array();
     if (!isset($_GET['value'])) {
         $errors[] = 'A product ID must be supplied';
     } else {
         if (!is_numeric($_GET['value'])) {
             $errors[] = "Provided product ID must be an integer";
         } else {
             if ($product = products::model()->getbyPK($_GET['value'])) {
                 $updateAttributes = array('name' => null, 'description' => null, 'price' => null, 'category_id' => null);
                 foreach ($updateAttributes as $updateAttribute => $value) {
                     if (isset($_GET[$updateAttribute])) {
                         $updateAttributes[$updateAttribute] = $_GET[$updateAttribute];
                     } else {
                         unset($updateAttributes[$updateAttribute]);
                     }
                 }
                 $product->setAttributes($updateAttributes);
                 if ($product->save()) {
                     $attributes = array('id', 'name', 'created', 'modified', 'description');
                     $datum = $this->returnValues($product, $attributes);
                     $datum['category_name'] = $product->category->name;
                     $datum['category_id'] = $product->category->id;
                     $data = array($datum);
                 } else {
                     $errors[] = 'The product could not be updated';
                 }
             } else {
                 $errors[] = 'Could not find product with ID of ' . $_GET['value'];
             }
         }
     }
     if (count($errors) > 0) {
         $this->renderApi(false, null, $errors);
     } else {
         $this->renderApi(true, $data);
     }
 }
示例#30
0
 /**
  * saveData
  * Save the record
  * @param posted var from the form
  * @return Boolean
  */
 public static function saveData($record, $sendemail = false)
 {
     // Set the new values
     if (!empty($record['review_id']) && is_numeric($record['review_id'])) {
         $review = self::getbyId($record['review_id']);
     } else {
         $review = new Reviews();
         $review->ip = $_SERVER['REMOTE_ADDR'];
     }
     // Get the latitude and longitude coordinates
     $coords = Shineisp_Commons_Utilities::getCoordinates($record['city']);
     $review->product_id = $record['product_id'];
     $review->publishedat = date('Y-m-d H:i:s');
     $review->nick = $record['nick'];
     $review->city = !empty($coords['results'][0]['formatted_address']) ? $coords['results'][0]['formatted_address'] : $record['city'];
     $review->referer = $record['referer'];
     $review->subject = $record['subject'];
     $review->latitude = !empty($coords['results'][0]['geometry']['location']['lat']) ? $coords['results'][0]['geometry']['location']['lat'] : $record['latitude'];
     $review->longitude = !empty($coords['results'][0]['geometry']['location']['lng']) ? $coords['results'][0]['geometry']['location']['lng'] : $record['longitude'];
     $review->email = $record['email'];
     $review->stars = $record['stars'];
     $review->active = isset($record['active']) ? $record['active'] : 0;
     $review->review = $record['review'];
     if ($review->trySave()) {
         if ($sendemail) {
             // Send the email to confirm the subscription
             $isp = Isp::getActiveISP();
             $placeholders['review'] = $record['review'];
             $placeholders['nick'] = $record['nick'];
             $placeholders['referer'] = $record['referer'];
             $placeholders['subject'] = $record['subject'];
             $placeholders['email'] = $record['email'];
             $placeholders['stars'] = $record['stars'];
             $placeholders['product'] = products::getAllInfo($record['product_id']);
             // Send a message to the administrator
             Shineisp_Commons_Utilities::sendEmailTemplate($isp['email'], 'review_new', $placeholders);
         }
         return $review->review_id;
     }
     return false;
 }