本文整理汇总了PHP中Inventory::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Inventory::add方法的具体用法?PHP Inventory::add怎么用?PHP Inventory::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makePurchase
function makePurchase()
{
$date = "{$_POST['date']} 02:02:02";
$this->purchaseType = "defaultPurchase";
//insert into sell and sellLog
//vendorType = [factory, factory, staff, bank, addition]
//
//do this in distraction free mode shift+f11
//first field name, then field value, type both at once first
db("insert into purchase\n\t\t\t(vendorIndex,vendor,memoNo,rawPrice,paid,due,date,purchaseType)\n\t\t\tvalues\n\t\t\t('{$this->factoryIndex}','factory','{$this->memoNo}','{$this->rawPrice}','{$this->paid}','{$this->due}','{$date}','{$this->purchaseType}')\n\t\t\t");
for ($index = 0; $index < $this->productList; $index++) {
$product = $this->product[$index];
//echo "('$this->memoNo','$product->pid','$product->descr','$product->qty','$product->sp','$product->cpDoz')";
db("insert into purchase_log\n\t\t\t\t(memoNo,pid,descr,qty,sp,cpDoz,date)\n\t\t\t\tvalues\n\t\t\t\t('{$this->memoNo}','{$product->pid}','{$product->descr}','{$product->qty}','{$product->sp}','{$product->cpDoz}','{$date}')\n\t\t\t\t");
Inventory::add($product);
}
}
示例2: Inventory
}
// Confirm if user already login
if (!empty($session->name) && in_array("admin", $user->rights)) {
// Display inventory panel
require_once 'model/inventory.php';
$inventory = new Inventory($session);
require_once 'view/inventory.php';
$inventoryPanel = new inventoryView($inventory);
$inventoryPanel->output();
$inventoryPanel->addBn();
$inventoryPanel->delBn();
// Check for inventory panel submissions
if (isset($_POST['addInventory'])) {
if (!$_POST['enterQty']) {
$boxMsg[] = "Please enter an amount first.";
} else {
$inventory->input($_POST['enterPid'], $_POST['enterQty']);
$inventory->add();
}
}
if (isset($_POST['delInventory'])) {
if (!$_POST['enterQty']) {
$boxMsg[] = "Please enter an amount first.";
} else {
$inventory->input($_POST['enterPid'], $_POST['enterQty']);
$inventory->delete();
}
}
} else {
$boxMsg[] = "Accessible only by Admins. Please login first.";
}
示例3: Inventory
<form method="post" action="<?php
echo $_SERVER['PHP_SELF'];
?>
" id="target">
<input type="text" name="product_txt" />
<button type="submit" name="submit" id="process">Submit</button>
</form>
<div class="result">
<?php
include 'terminal.php';
include 'inventory.php';
// Initialize inventory, listings, and terminal objects.
$product_inventory = new Inventory();
// add products and prices here.
$product_inventory->add("A", 2.0, [4 => '7.00']);
$product_inventory->add("B", 12.0);
$product_inventory->add("C", 1.25, [6 => 6.0]);
$product_inventory->add("D", 0.15);
$product_listing = new Listing($product_inventory);
$terminal = new Terminal($product_listing);
//$terminal->setUnitPricing("A", 3.50);
//$terminal->setVolumePricing("A", [2=>2.40, 7=>10.00]);
// process form data
if (isset($_POST["submit"])) {
$products = $_POST["product_txt"];
for ($i = 0; $i < strlen($products); $i++) {
if ($products[$i] != " ") {
$scannable = $terminal->scan($products[$i]);
}
// did the product go into the system?