当前位置: 首页>>代码示例>>PHP>>正文


PHP Purchase类代码示例

本文整理汇总了PHP中Purchase的典型用法代码示例。如果您正苦于以下问题:PHP Purchase类的具体用法?PHP Purchase怎么用?PHP Purchase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Purchase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addPurchase

 /**
  * Добавляем покупку
  * @param Purchase $purchase
  */
 public function addPurchase(Purchase $purchase)
 {
     $id = $purchase->getProduct()->getId();
     if (isset($this->purchases[$id])) {
         $this->purchases[$id]->setCount($this->purchases[$id]->getCount() + $purchase->getCount());
     } else {
         $this->purchases[$id] = $purchase;
     }
     $this->customer->addOrder($this);
 }
开发者ID:Kompaneytsev,项目名称:market-place,代码行数:14,代码来源:Order.php

示例2: orders

 public function orders()
 {
     require_once '../app/models/Purchase.php';
     $model = new Purchase();
     $purchaseList = $model->generatePurchaseArray();
     $view = new View('purchases/index');
     $view->set_title('Your Orders');
     $view->pass_data('purchaseList', $purchaseList);
     $view->load_page();
 }
开发者ID:matthewleighton,项目名称:online_shop,代码行数:10,代码来源:account_controller.php

示例3: store

 /**
  * Store a newly created stock in storage.
  *
  * @return Response
  */
 public function store()
 {
     $stock = new Purchase();
     $stock->item = Input::get('item');
     $stock->selling_price = Input::get('selling_price');
     $stock->price = Input::get('purchase_price');
     $stock->quantity = Input::get('quantity');
     $stock->status = Input::get('status');
     $stock->account = Input::get('account');
     $stock->save();
     return Redirect::route('purchases.index');
 }
开发者ID:kenkode,项目名称:gasexpress,代码行数:17,代码来源:PurchasesController.php

示例4: delete

 /**
  * this method is needed to 
  * delete from a vendor list
  */
 public function delete($id)
 {
     $article = Purchase::find_by_id($id);
     if ($article->delete()) {
         return true;
     }
 }
开发者ID:runningjack,项目名称:RobertJohnson,代码行数:11,代码来源:stockin_model.php

示例5: checkDuplicatePo

 static function checkDuplicatePo($key)
 {
     $purchase = new Purchase($key);
     //Search Duplicate
     $records = fRecordSet::build('Purchase', array('po_number=' => $purchase->getPoNumber()));
     if ($records->count() > 1) {
         //Generate New PO
         echo 'Duplicate PO';
         $exploded = explode('/', $purchase->getPoNumber());
         echo (int) $exploded[2] + 1;
         $exploded[2] = sprintf("%03d", (int) $exploded[2] + 1);
         $newPONumber = implode('/', $exploded);
         $purchase->setPoNumber($newPONumber);
         $purchase->store();
     }
 }
开发者ID:JhunCabas,项目名称:material-management,代码行数:16,代码来源:Purchase.php

示例6: search

 /**
  * Search Licenses
  */
 static function search($q = NULL, $param = NULL, $product_code = NULL)
 {
     $_tbl_licenses = License::getTableName();
     $_tbl_licensesUses = LicensesUses::getTableName();
     $_tbl_transactions = Transaction::getTableName();
     $_tbl_purchases = Purchase::getTableName();
     $_tbl_products = Product::getTableName();
     $_tbl_plans = Plan::getTableName();
     $_tbl_buyers = Buyer::getTableName();
     $fields = array("{$_tbl_licenses}.*", DB::raw("COUNT({$_tbl_licensesUses}.id) AS totalUsed"), "{$_tbl_buyers}.first_name", "{$_tbl_buyers}.last_name", "{$_tbl_buyers}.email", "{$_tbl_products}.code", "{$_tbl_plans}.code AS plan_code", "{$_tbl_products}.api_key");
     $licenses = DB::table($_tbl_licenses)->leftJoin($_tbl_licensesUses, "{$_tbl_licensesUses}.license_id", '=', "{$_tbl_licenses}.id")->join($_tbl_transactions, "{$_tbl_transactions}.id", '=', "{$_tbl_licenses}.transaction_id")->join($_tbl_plans, "{$_tbl_transactions}.plan_id", '=', "{$_tbl_plans}.id")->join($_tbl_purchases, "{$_tbl_purchases}.id", '=', "{$_tbl_transactions}.purchase_id")->join($_tbl_products, "{$_tbl_products}.id", '=', "{$_tbl_purchases}.product_id")->join($_tbl_buyers, "{$_tbl_buyers}.id", '=', "{$_tbl_purchases}.buyer_id")->select($fields)->groupBy("{$_tbl_licenses}.id");
     $q = $q ? $q : Input::get('q');
     $param = $param ? $param : Input::get('param');
     if ($q) {
         if ($param == "key") {
             $licenses = $licenses->where("license_key", '=', $q);
         }
         if ($param == "email") {
             $licenses = $licenses->where("email", '=', $q);
         }
         if ($product_code) {
             $licenses = $licenses->where($_tbl_licenses . ".license_key", 'LIKE', strtoupper($product_code) . '-%');
         }
     }
     return $licenses->orderBy($_tbl_licenses . '.created_at', 'DESC')->paginate(25);
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:29,代码来源:License.php

示例7: createBaseFromData

 protected static function createBaseFromData(\stdClass $data)
 {
     $object = new static();
     $object->type = $data->type;
     $object->uuid = $data->uuid;
     $object->revisionHash = $data->hash;
     $object->availableLanguageCodes = $data->languages;
     $object->status = $data->status;
     $object->contentProvider = ContentProvider::createFromData($data->content_provider);
     if (isset($data->location)) {
         $object->location = Location::createFromData($data->location);
     }
     if (isset($data->trigger_zones)) {
         foreach ($data->trigger_zones as $triggerZoneData) {
             $object->triggerZones[] = TriggerZone::createFromData($triggerZoneData);
         }
     }
     if (isset($data->purchase)) {
         $object->purchase = Purchase::createFromData($data->purchase);
     }
     if (isset($data->publisher)) {
         $object->publisher = PublisherBase::createFromData($data->publisher);
     }
     if (isset($data->city)) {
         $object->city = CityBase::createFromData($data->city);
     }
     if (isset($data->country)) {
         $object->country = CountryBase::createFromData($data->country);
     }
     return $object;
 }
开发者ID:triquanta,项目名称:libizi,代码行数:31,代码来源:MtgObjectBase.php

示例8: purchase_edit

function purchase_edit()
{
    $session = Session::getInstance();
    if (!$session->checkLogin()) {
        return false;
    }
    $purchase = new Purchase();
    $purchase->id = isset($_POST['purchase']) ? $_POST['purchase'] : "";
    $purchase->status = isset($_POST['status']) ? $_POST['status'] : "";
    $purchase->update();
    if (isset($_POST['payment']) && is_numeric($_POST['payment'])) {
        $purchasePayment = new PurchasePayment();
        $purchasePayment->purchaseid = isset($_POST['purchase']) ? $_POST['purchase'] : "";
        $purchasePayment->amount = isset($_POST['payment']) ? $_POST['payment'] : "";
        $purchasePayment->add();
    }
}
开发者ID:BackupTheBerlios,项目名称:rinventory-svn,代码行数:17,代码来源:purchase.php

示例9: show

 /**
  * Display customer profile
  *
  * @param $profile
  * @return Response
  */
 public function show($profile)
 {
     $p = User::where('profile_url', '=', $profile)->where('approved', '=', '0')->first();
     $page = Page::where('title', '=', 'faq-customer')->first();
     $follow = Follow::where('user', $p->id)->where('hub', '=', 0)->get();
     $follow_hub = Follow::where('user', $p->id)->where('artist', '=', 0)->get();
     $wall = new \Illuminate\Database\Eloquent\Collection();
     $events = new \Illuminate\Database\Eloquent\Collection();
     $comments = Comment::where('user', '=', $p->id)->orderBy('created_at', 'desc')->get();
     $hidden = unserialize(Cookie::get('hide'));
     //dd( Cookie::get('hide') );
     if (count($follow) > 0) {
         foreach ($follow as $f) {
             $s = Song::where('artist', '=', $f->artist)->where('completed', '=', '1')->get();
             $e = ArtistEvent::where('artist', '=', $f->artist)->where('date', '>', \Carbon\Carbon::now())->get();
             $wall = $wall->merge($s);
             $events = $events->merge($e);
         }
     }
     if (count($follow_hub) > 0) {
         foreach ($follow_hub as $h) {
             $hub = Hub::where('id', '=', $h->hub)->first();
             if (!is_null($hub)) {
                 $artists = User::where('type', '=', 'artist')->where('hub', '=', $hub->id)->get();
                 $artists_list = [];
                 $songs = [];
                 $events = [];
                 foreach ($artists as $a) {
                     $artists_list[] = $a->id;
                 }
                 if (count($artists_list) > 0) {
                     $songs = Song::where('completed', '=', '1')->whereIn('artist', $artists_list)->orderBy('created_at', 'desc')->get();
                     $events = ArtistEvent::whereIn('artist', $artists_list)->get();
                 }
                 $news = News::where('hub', '=', $hub->id)->take(3)->get();
                 $wall = $wall->merge($songs);
                 $events = $events->merge($events);
             }
         }
     }
     $purchased = Purchase::where('customer', '=', $p->id)->get();
     foreach ($purchased as $pp) {
         $song_purchased = Song::withTrashed()->where('id', '=', $pp->song)->get();
         $download = Download::where('customer', '=', $p->id)->where('song', '=', $pp->song)->first();
         $song_purchased[0]->purchased = true;
         if (isset($download)) {
             $song_purchased[0]->link = $download->url;
         }
         $wall = $wall->merge($song_purchased);
     }
     $wall->sortByDesc('created_at');
     if (!isset($news)) {
         $news = null;
     }
     return View::make('customer.profile-new', ['profile' => $p, 'wall' => $wall, 'page' => $page, 'events' => $events, 'comments' => $comments, 'hidden' => $hidden, 'news' => $news]);
 }
开发者ID:centaurustech,项目名称:musicequity,代码行数:62,代码来源:CustomerController.php

示例10: create

    public static function create(DB $db, Amount $denom, Purchase $p)
    {
        $prepared = $db->prepare('
			INSERT INTO `bills` (
				`entered_at`,
				`denomination`,
				`purchase_id`
			) VALUES (
				NOW(),
				:denomination,
				:purchase_id
			)
		');
        $result = $prepared->execute(array(':denomination' => $denom->get(), ':purchase_id' => $p->getId()));
        if ($result === false) {
            throw new Exception("Unable to log bill.");
        }
        return self::load($db, $db->lastInsertId());
    }
开发者ID:oktoshi,项目名称:skyhook,代码行数:19,代码来源:Bill.php

示例11: getDetail

 public function getDetail()
 {
     //$id = \Input::get('id');
     $input = \Input::all();
     if ($input['type'] == 'sale') {
         $detail = Sale::find($input['id']);
     } else {
         $detail = Purchase::find($input['id']);
     }
     return \Response::json($detail);
 }
开发者ID:sujithma,项目名称:shopherebackend,代码行数:11,代码来源:AdminController.php

示例12: boot

 public static function boot()
 {
     parent::boot();
     static::deleted(function ($supplier) {
         $supplier->purchases()->delete();
         $purchases = Purchase::where('supplier_id', '=', $supplier->id);
         dd($purchases);
         $purchases->items()->detach();
         $purchases->receivings()->delete();
         $purchases->payments()->delete();
     });
 }
开发者ID:jmramos02,项目名称:catering,代码行数:12,代码来源:Supplier.php

示例13: export_purchases

	/**
	 * Delivers order export files to the browser
	 *
	 * @since 1.1
	 *
	 * @return void
	 **/
	function export_purchases () {
		if (!current_user_can('ecart_financials') || !current_user_can('ecart_export_orders')) exit();

		if (!isset($_POST['settings']['purchaselog_columns'])) {
			$Purchase = Purchase::exportcolumns();
			$Purchased = Purchased::exportcolumns();
			$_POST['settings']['purchaselog_columns'] =
			 	array_keys(array_merge($Purchase,$Purchased));
			$_POST['settings']['purchaselog_headers'] = "on";
		}
		$this->Settings->saveform();

		$format = $this->Settings->get('purchaselog_format');
		if (empty($format)) $format = 'tab';

		switch ($format) {
			case "csv": new PurchasesCSVExport(); break;
			case "xls": new PurchasesXLSExport(); break;
			case "iif": new PurchasesIIFExport(); break;
			default: new PurchasesTabExport();
		}
		exit();

	}
开发者ID:robbiespire,项目名称:paQui,代码行数:31,代码来源:Resources.php

示例14: updatePurchase

 public function updatePurchase($Id, &$amount)
 {
     $model = Purchase::model()->findByPk($Id);
     $amount = $model->amount;
     $ttlamount = 0;
     foreach($model->purchaseproducts as $product)
     {
         $ttlamount += $product->amount;
     }
     $model->amount= $ttlamount;
     $status = $model->save();
     if($status)
     {
         $amount = $ttlamount;
     }
     return $status;
 }
开发者ID:Rajagunasekaran,项目名称:BACKUP,代码行数:17,代码来源:Controller.php

示例15: executeGeneratePurchase

 public function executeGeneratePurchase(sfWebRequest $request)
 {
     $invoice = Doctrine_Query::create()->from('Invoice i')->where('i.id = ' . $request->getParameter('id'))->fetchOne();
     //create purchase
     $purchase = new Purchase();
     $purchase->setDate(date("Y-m-d"));
     $purchase->setPono(date('h:i:s a'));
     $purchase->save();
     //create purchase details
     foreach ($invoice->getInvoicedetail() as $invdetail) {
         $purchdetail = new PurchaseDetail();
         $purchdetail->setPurchaseId($purchase->getId());
         $purchdetail->setProductId($invdetail->getProductId());
         $purchdetail->setDescription($invdetail->getProduct()->getName());
         $purchdetail->setQty($invdetail->getQty());
         $purchdetail->setPrice(0);
         $purchdetail->setTotal(0);
         $purchdetail->setUnittotal(0);
         $purchdetail->save();
         $purchdetail->updateStockentry();
     }
     $this->redirect("purchase/view?id=" . $purchase->getId());
 }
开发者ID:jaspertomas,项目名称:tmcprogram_tacloban,代码行数:23,代码来源:actions.class.php


注:本文中的Purchase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。