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


PHP Item::setDiscount方法代码示例

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


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

 public function test_accessors()
 {
     /** === Test Data === */
     $DISCOUNT = 'discount';
     $SALE_ITEM_ID = 'sale item id';
     $SUBTOTAL = 'subtotal';
     $TOTAL = 'total';
     /** === Call and asserts  === */
     $this->obj->setDiscount($DISCOUNT);
     $this->obj->setSaleItemId($SALE_ITEM_ID);
     $this->obj->setSubtotal($SUBTOTAL);
     $this->obj->setTotal($TOTAL);
     $this->assertEquals($DISCOUNT, $this->obj->getDiscount());
     $this->assertEquals($SALE_ITEM_ID, $this->obj->getSaleItemId());
     $this->assertEquals($SUBTOTAL, $this->obj->getSubtotal());
     $this->assertEquals($TOTAL, $this->obj->getTotal());
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_pv,代码行数:17,代码来源:Item_Test.php

示例3: 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

示例4: initializeWithRawData

 /**
  * Initialize the object with raw data
  *
  * @param $data
  * @return Item
  */
 public static function initializeWithRawData($data)
 {
     $item = new Item();
     if (isset($data['description'])) {
         $item->setDescription($data['description']);
     }
     if (isset($data['amount'])) {
         $item->setAmount($data['amount']);
     }
     if (isset($data['price'])) {
         $item->setPrice($data['price']);
     }
     if (isset($data['vat'])) {
         $item->setVat($data['vat']);
     }
     if (isset($data['reference_id'])) {
         $item->setReferenceId($data['reference_id']);
     }
     if (isset($data['total_without_vat'])) {
         $item->setTotalWithoutVat($data['total_without_vat']);
     }
     if (isset($data['total_vat'])) {
         $item->setTotalVat($data['total_vat']);
     }
     if (isset($data['total_with_vat'])) {
         $item->setTotalWithVat($data['total_with_vat']);
     }
     if (isset($data['discount'])) {
         $item->setDiscount($data['discount']);
     }
     if (isset($data['percentage'])) {
         $item->setDiscountIsPercentage($data['percentage']);
     }
     if (isset($data['discount_description'])) {
         $item->setDiscountDescription($data['discount_description']);
     }
     return $item;
 }
开发者ID:sumocoders,项目名称:factr,代码行数:44,代码来源:Item.php

示例5: 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

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