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


PHP Item::setQuantity方法代码示例

本文整理汇总了PHP中Item::setQuantity方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::setQuantity方法的具体用法?PHP Item::setQuantity怎么用?PHP Item::setQuantity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


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

示例1: gerateBilling

 public function gerateBilling()
 {
     $order = null;
     $customers = $this->getUserID();
     $structJsonArray = array();
     foreach ($customers as $customer) {
         $structJson = new Json();
         $structJson->setCustomerId($customer['zoho_books_contact_id']);
         $structJson->setDate(date('d-m-Y'));
         $invoices_per_costumer = $this->getUserInvoice($customer['zoho_books_contact_id']);
         //var_dump($invoices_per_costumer);
         foreach ($invoices_per_costumer as $invoice_each) {
             $item = new Item();
             $order++;
             $item->setItemId("460000000027017");
             $item->setProjectId("");
             $item->setExpenseId("");
             $item->setName("Print Services");
             $item->setDescription($invoice_each['description']);
             $item->setItemOrder($order);
             $item->setRate($invoice_each['rate']);
             $item->setUnit("Nos");
             $item->setQuantity(1.0);
             $item->setDiscount(0.0);
             $item->setTaxId("460000000027005");
             $structJson->setLineItems($item);
             $item = null;
         }
         $structJson->setNotes("Thanks for your business.");
         $order = null;
         $structJsonArray[] = $structJson;
         $structJson = null;
     }
     return $structJsonArray;
 }
开发者ID:denisolvr,项目名称:Billing-Code-Test,代码行数:35,代码来源:Bill.php

示例2: executeCalculate

 /**
  * Receives the Invoice form data and calculates each row total amount and
  * full invoice totals. Returns a json
  *
  * @param 'invoice' from Request
  * @return JSON through Response
  */
 public function executeCalculate(sfWebRequest $request)
 {
     $currency = PropertyTable::get('currency');
     $format = new sfNumberFormat($this->culture);
     $data = $request->getParameter('invoice');
     $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
     $invoice = new Invoice();
     $items = array();
     $totals = array();
     if (isset($data['Items'])) {
         foreach ((array) $data['Items'] as $itemId => $itemData) {
             if ($itemData['remove']) {
                 continue;
             }
             $item = new Item();
             $item->setUnitaryCost($itemData['unitary_cost']);
             $item->setQuantity($itemData['quantity']);
             $item->setDiscount($itemData['discount']);
             if (isset($itemData['taxes_list'])) {
                 $taxes = Doctrine::getTable('Tax')->createQuery()->whereIn('id', $itemData['taxes_list'])->execute();
                 $item->Taxes = $taxes;
             }
             $items[$itemId] = $format->format($item->getGrossAmount(), 'c', $currency);
             $invoice->Items[] = $item;
         }
         $totals['base'] = $format->format($invoice->calculate('base_amount', true), 'c', $currency);
         $totals['discount'] = $format->format($invoice->calculate('discount_amount', true), 'c', $currency);
         $totals['net'] = $format->format($invoice->calculate('net_amount', true), 'c', $currency);
         $totals['taxes'] = $format->format($invoice->calculate('tax_amount', true), 'c', $currency);
         $totals['gross'] = $format->format($invoice->calculate('gross_amount', true), 'c', $currency);
     } else {
         $zero = $format->format(0, 'c', $currency);
         $totals['base'] = $zero;
         $totals['discount'] = $zero;
         $totals['net'] = $zero;
         $totals['taxes'] = $zero;
         $totals['gross'] = $zero;
     }
     return $this->renderText(json_encode(array('items' => $items, 'totals' => $totals)));
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:47,代码来源:actions.class.php

示例3: setItemsByData

 /**
  * @param array $data
  */
 public function setItemsByData($data)
 {
     foreach ($data as $itemData) {
         $item = new Item();
         if (isset($itemData['item'])) {
             $itemData = array_merge($itemData, $itemData['item']);
         }
         // stop if quantity is smaller than 0
         if ($this->getProperty('quantity', $itemData, 0) < 1) {
             continue;
         }
         $item->setPrice($this->getProperty('price', $itemData, 0));
         $item->setQuantity($this->getProperty('quantity', $itemData));
         $item->setQuantityUnit($this->getProperty('quantityUnit', $itemData));
         $item->setAddress($this->getProperty('address', $itemData));
         $item->setUseProductsPrice($this->getProperty('useProductsPrice', $itemData));
         $item->setDeliveryDate($this->getProperty('deliveryDate', $itemData));
         $item->setNetShippingCosts($this->getProperty('netShippingCosts', $itemData));
         if (isset($itemData['product'])) {
             $product = new Product($this->getProperty('id', $itemData['product']));
             $item->setProduct($product);
         }
         // set account to customer
         if (isset($itemData['account']) && !isset($itemData['customer'])) {
             $itemData['customer'] = $itemData['account'];
         }
         if (isset($itemData['customer'])) {
             $customer = new Account($this->getProperty('id', $itemData['customer']), $this->getProperty('name', $itemData['customer']));
             $item->setCustomerAccount($customer);
         }
         if (isset($itemData['supplier'])) {
             $customer = new Account($this->getProperty('id', $itemData['supplier']), $this->getProperty('name', $itemData['supplier']));
             $item->setSupplierAccount($customer);
         }
         // add to items array
         $this->items[] = $item;
         // create ordered item arrays
         $customerId = 0;
         $supplierId = 0;
         if ($item->getCustomerAccount()) {
             $customerId = $item->getCustomerAccount()->getId();
         }
         if ($item->getSupplierAccount()) {
             $supplierId = $item->getSupplierAccount()->getId();
         }
         $this->customerItems[$customerId][] = $item;
         $this->customerSupplierItems[$customerId]['supplierItems'][$supplierId][] = $item;
     }
 }
开发者ID:sulu,项目名称:sulu-sales,代码行数:52,代码来源:TransitionData.php

示例4: generateInvoiceItems

 protected function generateInvoiceItems()
 {
     for ($j = 0; $j < mt_rand(1, 10); $j++) {
         $item = new Item();
         $item->setDescription($this->items[array_rand($this->items)]);
         $item->setUnitaryCost(mt_rand(100, 100000) / 100);
         $item->setQuantity(mt_rand(1, 10));
         if (mt_rand(1, 15) == 1) {
             $item->setDiscount(mt_rand(1, 70));
         }
         $max_tax = mt_rand(1, 10) == 1 ? mt_rand(1, 3) : 1;
         for ($kk = 0; $kk < $max_tax; $kk++) {
             $item->Taxes[] = $this->getRandomTax();
         }
         $this->inv->Items[] = $item;
     }
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:17,代码来源:RandomDataLoadTask.class.php

示例5: addItem

 /**
  * Adds a new product/item in this payment request
  * 
  * @param String $id
  * @param String $description
  * @param String $quantity
  * @param String $amount
  * @param String $weight
  * @param String $shippingCost
  */
 public function addItem($id, $description = null, $quantity = null, $amount = null, $weight = null, $shippingCost = null)
 {
     $param = $id;
     if ($this->items == null) {
         $this->items = array();
     }
     if (is_array($param)) {
         array_push($this->items, new Item($param));
     } else {
         if ($param instanceof Item) {
             array_push($this->items, $param);
         } else {
             $item = new Item();
             $item->setId($param);
             $item->setDescription($description);
             $item->setQuantity($quantity);
             $item->setAmount($amount);
             $item->setWeight($weight);
             $item->setShippingCost($shippingCost);
             array_push($this->items, $item);
         }
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:33,代码来源:PaymentRequest.class.php

示例6: parseTransactionItem

 private static function parseTransactionItem($data)
 {
     // <transaction> <items> <item>
     $item = new Item();
     // <transaction> <items> <item> <id>
     if (isset($data["id"])) {
         $item->setId($data["id"]);
     }
     // <transaction> <items> <item> <description>
     if (isset($data["description"])) {
         $item->setDescription($data["description"]);
     }
     // <transaction> <items> <item> <quantity>
     if (isset($data["quantity"])) {
         $item->setQuantity($data["quantity"]);
     }
     // <transaction> <items> <item> <amount>
     if (isset($data["amount"])) {
         $item->setAmount($data["amount"]);
     }
     // <transaction> <items> <item> <weight>
     if (isset($data["weight"])) {
         $item->setWeight($data["weight"]);
     }
     return $item;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:26,代码来源:TransactionParser.class.php

示例7: dirname

<?php

include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(6, new lime_output_color());
$t->diag('Item class tests');
$item = new Item();
$item->setUnitaryCost(1234.214);
$item->setQuantity(3);
$item->setDiscount(13);
$tax1 = new Tax();
$tax2 = new Tax();
$tax1->setValue(16);
$tax2->setValue(4);
$item->Taxes[] = $tax1;
$item->Taxes[] = $tax2;
$base = 1234.214 * 3;
$discount = $base * 13 / 100;
$taxAmount = ($base - $discount) * ($tax1->value + $tax2->value) / 100;
$t->is($item->getBaseAmount(), $base, 'getBaseAmount()');
$t->is($item->getNetAmount(), $base - $discount, 'getNetAmount()');
$t->is($item->getDiscountAmount(), $discount, 'getDiscountAmount()');
$t->is($item->getTaxAmount(), $taxAmount, 'getTaxAmount()');
$t->is($item->getGrossAmount(), $base - $discount + $taxAmount, 'getGrossAmount()');
$t->is($item->getTaxesPercent(), $tax1->value + $tax2->value, 'getTaxesPercent()');
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:24,代码来源:ItemTest.php


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