本文整理汇总了PHP中Items::find_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Items::find_by_id方法的具体用法?PHP Items::find_by_id怎么用?PHP Items::find_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Items
的用法示例。
在下文中一共展示了Items::find_by_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAddPart
public function createAddPart()
{
if (isset($_POST['itemid']) && !empty($_POST['wid'])) {
$worksheet = Worksheet::find_by_id($_POST['wid']);
$myItem = Items::find_by_id($_POST['itemid']);
$propart = new Prodpart();
$propart->part_name = $myItem->item_name;
$propart->qty = $_POST['qty'];
$propart->works_id = $_POST['wid'];
$propart->prod_id = $worksheet->prod_id;
$propart->item_id = $_POST['itemid'];
$propart->date_changed = date("Y:m:d H:i:s");
$propart->desc = "";
$propart->unit_cost = $_POST['price'];
$propart->total_cost = (int) $_POST['price'] * (int) $_POST['qty'];
if ($propart->create()) {
return $propart;
} else {
return false;
}
}
}
示例2: createAddPart
public function createAddPart()
{
if (isset($_REQUEST['itemid']) && !empty($_REQUEST['wid'])) {
$worksheet = Worksheet::find_by_id($_REQUEST['wid']);
$myItem = Items::find_by_id($_REQUEST['itemid']);
$propart = new Prodpart();
$propart->part_name = $myItem->item_name;
$propart->qty = $_REQUEST['qty'];
$propart->works_id = $_REQUEST['wid'];
$propart->prod_id = $worksheet->prod_id;
$propart->item_id = $_REQUEST['itemid'];
$propart->datecreated = date("Y:m:d H:i:s");
$propart->des = "";
$propart->unit_cost = $_REQUEST['price'];
$propart->total_cost = (int) $_REQUEST['price'] * (int) $_REQUEST['qty'];
$Tlog = new Transaction();
$Tlog->com_id = $myItem->item_id;
$Tlog->trans_type = "WORKSHEET PART SUPPLY";
$Tlog->trans_description = "allocation of resources to worksheet";
$Tlog->datecreated = date("Y-m-d H:i:s");
$Tlog->user_id = $_SESSION['emp_ident'];
if ($propart->create()) {
$Tlog->create();
return $propart;
} else {
return false;
}
}
}
示例3: doAddToCart
/**
* cart model to maitain items array
* in cart befor it is been posted to
* the purchases table
*/
public function doAddToCart()
{
$basket = new Cart();
$mcart = "";
$basket->addItem($_POST['ppid'], $_POST['ppname'], $_POST['pcatname'], $_POST['pqty'], $_POST['pprice']);
$myItems = $basket->getContents();
// the basket get arrays of items in the cart
$quantity = $_POST['pqty'];
$subTotal = $basket->getTotal();
// the basket gets the total of the items as subtotal
$vat = 0.05 * $subTotal;
// calculates the vat
$total = $subTotal + $vat;
$mcart .= "<table id='minicart-a' summary='Employee Pay Sheet'>\n <thead>\n \t<tr>\n <th width='10%' scope='col'>ItemID</th>\n \t<th width='35%' scope='col' >Description</th>\n <th width='20%' scope='col'>Qty</th>\n <th width='10%' scope='col'>Cost</th>\n <th width='10%' scope='col'>Total</th>\n \n </tr>\n </thead>\n <tbody>";
//print_r($item['itemName']);
$qt = 0;
foreach ($myItems as $item) {
$myproduct = Items::find_by_id($item['itemId']);
//print_r($myproduct);
$mcart .= "<tr>\n \n <td>" . $item['itemName'] . "</td>\n <td>" . $myproduct->item_description . "</td>\n <td><span>\n <input type='text' name='qty' id='qty" . $qt . "' value='" . $item['itemQuantity'] . "' style='width:40px; padding:2px; height:36px; text-align:center; ' />\n </span> <span><a href='#' class='modifyqty' prodid='" . $item['itemId'] . "' prodqty='" . $item['itemQuantity'] . "' tprice='" . $item['itemPrice'] . "' count ='" . $qt . "' ><img src='public/icons/Refresh16.png' width='18' height='18' /></a></span> <span><a href='#' class='deleteitem' prodid='" . $item['itemId'] . "' ><img src='public/icons/Delete16.png' width='18' height='18' /></a></span></td>\n <td>₦" . number_format($item['itemPrice'], 2, '.', ',') . "</td>\n <td>₦" . number_format($item['itemTotal'], 2, '.', ',') . "</td>\n </tr>";
$qt++;
}
/**
* foreach($myItems as $item){
* $mcart .="<tr>
* <td>".$item['itemQuantity']."</td>
* <td>".$item['itemName']."</td>
* <td>₦".$item['itemName']."</td>
* <td>".number_format($item['itemPrice'],2,'.',',')."</td>
* <td><span class='bold'>₦".number_format($item['itemTotal'],2,'.',',')."</span></td>
* <td><span class='bold'>x</span></td>
* </tr>
*
* ";
* }
*/
$mcart .= "<tr>\n \t<td> </td>\n <td> </td>\n <td> </td>\n <td> </td>\n <td> </td>\n </tr> \n\t <tr>\n <td> </td>\n <td colspan='3' align='right'><h3 class='black'>SubTotal:</h3></td>\n <td colspan='3' align='right'><span class='bold'>₦" . number_format($subTotal, 2, '.', ',') . "</span></td>\n </tr>\n <tr>\n <td> </td>\n <td colspan='3' align='right'><h3 class='black'>VAT(5%):</h3></td>\n <td colspan='3' align='right'><span class='bold'>₦" . number_format($vat, 2, '.', ',') . "</span></td>\n </tr>\n <tr>\n <td> </td>\n <td colspan='3' align='right'><h3><span class='black'>Total:</span></h3></td>\n <td colspan='3' align='right'><div class='divider'></div><h3 class='bold'>₦" . number_format($total, 2, '.', ',') . "</h3><div class='divider'></div><div class='divider'></div></td>\n </tr>\n <tr>\n \t<td> </td>\n <td colspan='3' align='right'><span style='margin:5px'><a href='#'>view cart</a></span></td>\n <td colspan='3'><span style='margin:5px'><a href='#'>Check out</a></span></td>\n </tr>\n </tbody>\n</table>";
print_r($mcart);
}
示例4: delete
public function delete($id)
{
$article = Items::find_by_id($id);
if ($article->delete()) {
return true;
}
}