本文整理汇总了PHP中Line::setRef2方法的典型用法代码示例。如果您正苦于以下问题:PHP Line::setRef2方法的具体用法?PHP Line::setRef2怎么用?PHP Line::setRef2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line::setRef2方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createStandardRequest
//.........这里部分代码省略.........
//Address
$request->setCompanyCode($calc['company_code']);
// Your Company Code From the Dashboard
$request->setDocDate(date('Y-m-d'));
//date, checked
$request->setCustomerCode(self::$vmadd['customer_number']);
//string Required
if (isset(self::$vmadd['tax_usage_type'])) {
$request->setCustomerUsageType(self::$vmadd['tax_usage_type']);
//string Entity Usage
}
if (isset(self::$vmadd['tax_exemption_number'])) {
$request->setExemptionNo(self::$vmadd['tax_exemption_number']);
//string if not using ECMS which keys on customer code
}
if (isset(self::$vmadd['taxOverride'])) {
$request->setTaxOverride(self::$vmadd['taxOverride']);
avadebug('I set tax override ', self::$vmadd['taxOverride']);
}
$setAllDiscounted = false;
if (isset($products['discountAmount'])) {
if (!empty($products['discountAmount'])) {
//$request->setDiscount($sign * $products['discountAmount'] * (-1)); //decimal
$request->setDiscount($sign * $products['discountAmount']);
//decimal
vmdebug('We sent as discount ' . $request->getDiscount());
$setAllDiscounted = true;
}
unset($products['discountAmount']);
}
$request->setDetailLevel('Tax');
//Summary or Document or Line or Tax or Diagnostic
$lines = array();
$n = 0;
$this->_lineNumbersToCartProductId = array();
foreach ($products as $k => $product) {
$n++;
$this->_lineNumbersToCartProductId[$n] = $k;
$line = new Line();
$line->setNo($n);
//string // line Number of invoice
$line->setItemCode($product['product_sku']);
//string
$line->setDescription($product['product_name']);
//product description, like in cart, atm only the name, todo add customfields
if (!empty($product['categories'])) {
//avadebug('AvaTax setTaxCode Product has categories !',$catNames);
if (!class_exists('TableCategories')) {
require JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'categories.php';
}
$db = JFactory::getDbo();
$catTable = new TableCategories($db);
foreach ($product['categories'] as $cat) {
$catTable->load($cat);
$catslug = $catTable->slug;
if (strpos($catslug, 'avatax-') !== FALSE) {
$taxCode = substr($catslug, 7);
if (!empty($taxCode)) {
$line->setTaxCode($taxCode);
} else {
vmError('AvaTax setTaxCode, category could not be parsed ' . $catslug);
}
break;
}
}
}
//$line->setTaxCode(""); //string
$line->setQty($product['amount']);
//decimal
$line->setAmount($sign * $product['price'] * $product['amount']);
//decimal // TotalAmmount
if ($setAllDiscounted or !empty($product['discount'])) {
$line->setDiscounted(1);
} else {
$line->setDiscounted(0);
}
$line->setRevAcct("");
//string
$line->setRef1("");
//string
$line->setRef2("");
//string
if (isset(self::$vmadd['tax_usage_type'])) {
$line->setCustomerUsageType(self::$vmadd['tax_usage_type']);
//string Entity Usage
}
if (isset(self::$vmadd['tax_exemption_number'])) {
$line->setExemptionNo(self::$vmadd['tax_exemption_number']);
//string if not using ECMS which keys on customer code
}
if (isset(self::$vmadd['taxOverride'])) {
//create new TaxOverride Object set
//$line->setTaxOverride(self::$vmadd['taxOverride']);
}
$lines[] = $line;
}
$this->newATConfig($calc);
$request->setLines($lines);
return $request;
}
示例2: foreach
//string
$line1->setDescription("Invoice Calculated From PHP SDK");
//string
$line1->setTaxCode("");
//string
$line1->setQty(1.0);
//decimal
$line1->setAmount(1000.0);
//decimal // TotalAmmount
$line1->setDiscounted(false);
//boolean
$line1->setRevAcct("");
//string
$line1->setRef1("");
//string
$line1->setRef2("");
//string
$line1->setExemptionNo("");
//string
$line1->setCustomerUsageType("");
//string
$request->setLines(array($line1));
//array
try {
$getTaxResult = $client->getTax($request);
echo 'GetTax is: ' . $getTaxResult->getResultCode() . "\n";
if ($getTaxResult->getResultCode() == SeverityLevel::$Success) {
echo "DocCode: " . $request->getDocCode() . "\n";
echo "TotalAmount: " . $getTaxResult->getTotalAmount() . "\n";
echo "TotalTax: " . $getTaxResult->getTotalTax() . "\n";
foreach ($getTaxResult->getTaxLines() as $ctl) {
示例3: _newLine
/**
* Makes a Line object from a product item object
*
* @param Mage_Sales_Model_Order_Invoice_Item|Mage_Sales_Model_Order_Creditmemo_Item $item
* @param bool $credit
* @return null
*/
protected function _newLine($item, $credit = false)
{
if ($this->isProductCalculated($item->getOrderItem())) {
return false;
}
if ($item->getQty() == 0) {
return false;
}
$line = new Line();
$storeId = $this->_retrieveStoreIdFromItem($item);
$price = $item->getBaseRowTotal();
if ($this->_getTaxDataHelper()->priceIncludesTax($storeId)) {
$line->setTaxIncluded(true);
$price = $item->getBaseRowTotalInclTax();
}
if ($this->_getTaxDataHelper()->applyTaxAfterDiscount($storeId)) {
$price -= $item->getBaseDiscountAmount();
}
if ($credit) {
//@startSkipCommitHooks
$price *= -1;
//@finishSkipCommitHooks
}
$line->setNo(count($this->_lines));
$line->setItemCode($this->_getCalculationHelper()->getItemCode($this->_getProductForItemCode($item), $storeId, $item));
$line->setDescription($item->getName());
$line->setQty($item->getQty());
$line->setAmount($price);
$line->setDiscounted((double) $item->getBaseDiscountAmount() && $this->_getTaxDataHelper()->applyTaxAfterDiscount($storeId));
$productData = $this->_getLineProductData($item, $storeId);
$line->setTaxCode($productData->getTaxCode());
$line->setRef1($productData->getRef1());
$line->setRef2($productData->getRef2());
$this->_lineToItemId[count($this->_lines)] = $item->getOrderItemId();
$this->_lines[] = $line;
}
示例4: _newLine
/**
* Makes a Line object from a product item object
*
* @param Varien_Object|Mage_Sales_Model_Quote_Item $item
* @return int|bool
*/
protected function _newLine($item)
{
$this->_addGwItemsAmount($item);
if ($this->isProductCalculated($item)) {
return false;
}
$product = $this->_getProductByProductId($item->getProductId());
$taxClass = $this->_getTaxClassCodeByProduct($product);
$price = $item->getBaseRowTotal() - $item->getBaseDiscountAmount();
$lineNumber = count($this->_lines);
$line = new Line();
$line->setNo($lineNumber);
$line->setItemCode(substr($item->getSku(), 0, 50));
$line->setDescription($item->getName());
$line->setQty($item->getQty());
$line->setAmount($price);
$line->setDiscounted($item->getDiscountAmount() ? true : false);
if ($taxClass) {
$line->setTaxCode($taxClass);
}
$ref1Value = $this->_getRefValueByProductAndNumber($product, 1, $item->getStoreId());
if ($ref1Value) {
$line->setRef1($ref1Value);
}
$ref2Value = $this->_getRefValueByProductAndNumber($product, 2, $item->getStoreId());
if ($ref2Value) {
$line->setRef2($ref2Value);
}
$this->_lines[$lineNumber] = $line;
$this->_lineToLineId[$lineNumber] = $item->getSku();
return $lineNumber;
}
示例5: _newLine
/**
* Makes a Line object from a product item object
*
* @param Varien_Object|Mage_Sales_Model_Quote_Item $item
* @return int|bool
*/
protected function _newLine($item)
{
if (!$item->getId()) {
$this->setCanSendRequest(false);
return $this;
}
$this->_addGwItemsAmount($item);
if ($this->isProductCalculated($item)) {
return false;
}
$product = $this->_getProductByProductId($this->_retrieveProductIdFromQuoteItem($item));
$taxClass = $this->_getTaxClassCodeByProduct($product);
$price = $item->getBaseRowTotal();
if ($this->_getTaxDataHelper()->applyTaxAfterDiscount($item->getStoreId())) {
$price = $item->getBaseRowTotal() - $item->getBaseDiscountAmount();
}
$lineNumber = count($this->_lines);
$line = new Line();
$line->setNo($lineNumber);
$line->setItemCode($this->_getCalculationHelper()->getItemCode($this->_getProductForItemCode($item), $item->getStoreId()));
$line->setDescription($item->getName());
$line->setQty($item->getTotalQty());
$line->setAmount($price);
$line->setDiscounted((double) $item->getDiscountAmount() && $this->_getTaxDataHelper()->applyTaxAfterDiscount($item->getStoreId()));
if ($this->_getTaxDataHelper()->priceIncludesTax($item->getStoreId())) {
$line->setTaxIncluded(true);
}
if ($taxClass) {
$line->setTaxCode($taxClass);
}
$ref1Value = $this->_getRefValueByProductAndNumber($product, 1, $item->getStoreId());
if ($ref1Value) {
$line->setRef1($ref1Value);
}
$ref2Value = $this->_getRefValueByProductAndNumber($product, 2, $item->getStoreId());
if ($ref2Value) {
$line->setRef2($ref2Value);
}
$this->_lines[$lineNumber] = $line;
$this->_lineToLineId[$lineNumber] = $item->getId();
return $lineNumber;
}
示例6: getTax
//.........这里部分代码省略.........
if (!isset($products[0]->amount)) {
$products[0]->amount = 1;
}
if (isset($calculationHelper->productPrices['discountAmount'])) {
$products[0]->discount = $calculationHelper->productPrices['discountAmount'];
} else {
$products[0]->discount = FALSE;
}
}
$lines = array();
$n = 0;
$lineNumbersToCartProductId = array();
foreach ($products as $k => $product) {
$n++;
$lineNumbersToCartProductId[$n] = $k;
$line = new Line();
$line->setNo($n);
//string // line Number of invoice
$line->setItemCode($product->product_sku);
//string
$line->setDescription($product->product_name);
//product description, like in cart, atm only the name, todo add customfields
//$line->setTaxCode(""); //string
$line->setQty($product->amount);
//decimal
$line->setAmount($product->price * $product->amount);
//decimal // TotalAmmount
$line->setDiscounted($product->discount * $product->amount);
//boolean
$line->setRevAcct("");
//string
$line->setRef1("");
//string
$line->setRef2("");
//string
if (isset($shopperData['tax_exemption_number'])) {
$line->setExemptionNo($shopperData['tax_exemption_number']);
//string
}
if (isset($shopperData['tax_usage_type'])) {
$line->setCustomerUsageType($shopperData['tax_usage_type']);
//string
}
$lines[] = $line;
}
$line = new Line();
$line->setNo(++$n);
//$lineNumbersToCartProductId[$n] = count($products)+1;
$line->setItemCode($cart->virtuemart_shipmentmethod_id);
$line->setDescription('Shipment');
$line->setQty(1);
//$line->setTaxCode();
$cartPrices = $calculationHelper->getCartPrices();
//vmdebug('$calculationHelper $cartPrices',$cartPrices);
$line->setAmount($cartPrices['shipmentValue']);
if (isset($shopperData['tax_exemption_number'])) {
$line->setExemptionNo($shopperData['tax_exemption_number']);
//string
}
if (isset($shopperData['tax_usage_type'])) {
$line->setCustomerUsageType($shopperData['tax_usage_type']);
//string
}
$lines[] = $line;
//vmdebug('avalaragetTax setLines',$lines);
$request->setLines($lines);
示例7: _newLine
/**
* Makes a Line object from a product item object
*
* @param Mage_Sales_Model_Order_Invoice_Item|Mage_Sales_Model_Order_Creditmemo_Item $item
* @param bool $credit
* @return null
*/
protected function _newLine($item, $credit = false)
{
if ($this->isProductCalculated($item->getOrderItem())) {
return false;
}
if ($item->getQty() == 0) {
return false;
}
$storeId = $this->_retrieveStoreIdFromItem($item);
$product = $this->_getProductByProductId($item->getProductId());
$taxClass = $this->_getTaxClassCodeByProduct($product);
$price = $item->getBaseRowTotal() - $item->getBaseDiscountAmount();
if ($credit) {
//@startSkipCommitHooks
$price *= -1;
//@finishSkipCommitHooks
}
$line = new Line();
$line->setNo(count($this->_lines));
$line->setItemCode($this->_getItemCode($this->_getProductForItemCode($item), $item, $storeId));
$line->setDescription($item->getName());
$line->setQty($item->getQty());
$line->setAmount($price);
$line->setDiscounted($item->getBaseDiscountAmount() ? true : false);
if ($taxClass) {
$line->setTaxCode($taxClass);
}
$ref1Value = $this->_getRefValueByProductAndNumber($product, 1, $storeId);
if ($ref1Value) {
$line->setRef1($ref1Value);
}
$ref2Value = $this->_getRefValueByProductAndNumber($product, 2, $storeId);
if ($ref2Value) {
$line->setRef2($ref2Value);
}
$this->_lineToItemId[count($this->_lines)] = $item->getOrderItemId();
$this->_lines[] = $line;
}
示例8: CalcTax
function CalcTax($taxSvcSoapClient, $companyCode)
{
$request = new GetTaxRequest();
$origin = new Address();
$destination = new Address();
$line1 = new Line();
$origin->setLine1("435 Ericksen Ave NE");
$origin->setLine2("Suite 200");
$origin->setCity("Bainbridge Island");
$origin->setRegion("WA");
$origin->setPostalCode("98110-1896");
$destination->setLine1("900 Winslow Way");
$destination->setLine2("Suite 200");
$destination->setCity("Bainbridge Island");
$destination->setRegion("WA");
$destination->setPostalCode("98110");
$request->setOriginAddress($origin);
//Address
$request->setDestinationAddress($destination);
//Address
$request->setCompanyCode($companyCode);
// Your Company Code From the Dashboard
$request->setDocType(DocumentType::$SalesInvoice);
// Only supported types are SalesInvoice or SalesOrder
$dateTime = new DateTime();
$docCode = "PHPSample" . date_format($dateTime, "dmyGis");
$request->setDocCode($docCode);
// invoice number
$request->setDocDate(date_format($dateTime, "Y-m-d"));
//date
$request->setSalespersonCode("");
// string Optional
$request->setCustomerCode("Cust123");
//string Required
$request->setCustomerUsageType("");
//string Entity Usage
$request->setDiscount(0.0);
//decimal
$request->setPurchaseOrderNo("");
//string Optional
$request->setExemptionNo("");
//string if not using ECMS which keys on customer code
$request->setDetailLevel(DetailLevel::$Document);
$request->setCommit("true");
// commit upon tax calc
$request->setReferenceCode("");
//string Optional
$request->setLocationCode("");
//string Optional - aka outlet id for tax forms
$line1->setNo("1");
//string // line Number of invoice
$line1->setItemCode("SKU123");
//string
$line1->setDescription("Invoice Calculated From PHP SDK");
//string
$line1->setTaxCode("");
//string
$line1->setQty(1.0);
//decimal
$line1->setAmount(1000.0);
//decimal // TotalAmmount
$line1->setDiscounted(false);
//boolean
$line1->setRevAcct("");
//string
$line1->setRef1("");
//string
$line1->setRef2("");
//string
$line1->setExemptionNo("");
//string
$line1->setCustomerUsageType("");
//string
$request->setLines(array($line1));
//array
try {
$getTaxResult = $taxSvcSoapClient->getTax($request);
echo 'GetTax Result: ' . $getTaxResult->getResultCode() . "\n";
if ($getTaxResult->getResultCode() == SeverityLevel::$Success) {
echo "DocCode: " . $request->getDocCode() . "\n";
echo "TotalAmount: " . $getTaxResult->getTotalAmount() . "\n";
echo "TotalTax: " . $getTaxResult->getTotalTax() . "\n";
} else {
foreach ($getTaxResult->getMessages() as $msg) {
echo $msg->getName() . ": " . $msg->getSummary() . "\n";
}
}
} catch (SoapFault $exception) {
$msg = "Exception: ";
if ($exception) {
$msg .= $exception->faultstring;
}
echo $msg . "\n";
echo $taxSvcSoapClient->__getLastRequest() . "\n";
echo $taxSvcSoapClient->__getLastResponse() . "\n";
}
return $request->getDocCode();
}
示例9: CreateTaxRequest
private function CreateTaxRequest($docCode)
{
$request = new GetTaxRequest();
//Set origin Address
$origin = new Address();
$origin->setLine1("Avalara");
$origin->setLine2("900 winslow way");
$origin->setLine3("Suite 100");
$origin->setCity("Bainbridge Island");
$origin->setRegion("WA");
$origin->setPostalCode("98110-1896");
$origin->setCountry("USA");
$request->setOriginAddress($origin);
//Set destination address
$destination = new Address();
$destination->setLine1("3130 Elliott");
$destination->setCity("Seattle");
$destination->setRegion("WA");
$destination->setPostalCode("98121");
$destination->setCountry("USA");
$request->setDestinationAddress($destination);
//Set line
$line1 = new Line();
$line1->setNo("1");
//string // line Number of invoice
$line1->setItemCode("SKU123");
//string
$line1->setDescription("Invoice Calculated From PHP SDK");
//string
$line1->setTaxCode("");
//string
$line1->setQty(1.0);
//decimal
$line1->setAmount(1000.0);
//decimal // TotalAmmount
$line1->setDiscounted(false);
//boolean
$line1->setRevAcct("");
//string
$line1->setRef1("");
//string
$line1->setRef2("");
//string
$line1->setExemptionNo("");
//string
$line1->setCustomerUsageType("");
//string
$line2 = new Line();
$line2->setNo("2");
//string // line Number of invoice
$line2->setItemCode("SKU124");
//string
$line2->setDescription("Invoice Calculated From PHP SDK");
//string
$line2->setTaxCode("");
//string
$line2->setQty(1.0);
//decimal
$line2->setAmount(10.0);
//decimal // TotalAmmount
$line2->setDiscounted(false);
//boolean
$line2->setRevAcct("");
//string
$line2->setRef1("");
//string
$line2->setRef2("");
//string
$line2->setExemptionNo("");
//string
$line2->setCustomerUsageType("");
//string
$request->setLines(array($line1, $line2));
$request->setCompanyCode('DEFAULT');
// Your Company Code From the Dashboard
$request->setDocType(DocumentType::$SalesInvoice);
// Only supported types are SalesInvoice or SalesOrder
//$dateTime=new DateTime();
//$docCode= "PHP".date_format($dateTime,"dmyGis");
$request->setDocCode($docCode);
// invoice number
$dateTime = new DateTime();
$docDate = date_format($dateTime, "Y-m-d");
//$request->setDocDate("2008-01-24"); //date
$request->setDocDate($docDate);
//date
$request->setSalespersonCode("");
// string Optional
$request->setCustomerCode("Cust123");
//string Required
$request->setCustomerUsageType("");
//string Entity Usage
$request->setDiscount(0.0);
//decimal
$request->setPurchaseOrderNo("");
//string Optional
$request->setExemptionNo("");
//string if not using ECMS which keys on customer code
$request->setDetailLevel(DetailLevel::$Diagnostic);
//Summary or Document or Line or Tax or Diagnostic
//.........这里部分代码省略.........
示例10: _newLine
/**
* Makes a Line object from a product item object
*
* @param Mage_Sales_Model_Order_Invoice_Item|Mage_Sales_Model_Order_Creditmemo_Item $item
* @param bool $credit
* @return null
*/
protected function _newLine($item, $credit = false)
{
if ($this->isProductCalculated($item->getOrderItem())) {
return false;
}
if ($item->getQty() == 0) {
return false;
}
$storeId = $this->_retrieveStoreIdFromItem($item);
$price = $item->getBaseRowTotal() - $item->getBaseDiscountAmount();
if ($credit) {
//@startSkipCommitHooks
$price *= -1;
//@finishSkipCommitHooks
}
$line = new Line();
$line->setNo(count($this->_lines));
$line->setItemCode($this->_getItemCode($item, $storeId));
$line->setDescription($item->getName());
$line->setQty($item->getQty());
$line->setAmount($price);
$line->setDiscounted($item->getBaseDiscountAmount() ? true : false);
$productData = $this->_getLineProductData($item, $storeId);
$line->setTaxCode($productData->getTaxCode());
$line->setRef1($productData->getRef1());
$line->setRef2($productData->getRef2());
$this->_lineToItemId[count($this->_lines)] = $item->getOrderItemId();
$this->_lines[] = $line;
}