本文整理汇总了PHP中Line::setExemptionNo方法的典型用法代码示例。如果您正苦于以下问题:PHP Line::setExemptionNo方法的具体用法?PHP Line::setExemptionNo怎么用?PHP Line::setExemptionNo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line::setExemptionNo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createStandardRequest
function createStandardRequest($calc, $products, $sign = 1)
{
if (!class_exists('TaxServiceSoap')) {
require VMAVALARA_CLASS_PATH . DS . 'TaxServiceSoap.class.php';
}
if (!class_exists('DocumentType')) {
require VMAVALARA_CLASS_PATH . DS . 'DocumentType.class.php';
}
if (!class_exists('DetailLevel')) {
require VMAVALARA_CLASS_PATH . DS . 'DetailLevel.class.php';
}
if (!class_exists('Line')) {
require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
}
if (!class_exists('ServiceMode')) {
require VMAVALARA_CLASS_PATH . DS . 'ServiceMode.class.php';
}
if (!class_exists('Line')) {
require VMAVALARA_CLASS_PATH . DS . 'Line.class.php';
}
if (!class_exists('GetTaxRequest')) {
require VMAVALARA_CLASS_PATH . DS . 'GetTaxRequest.class.php';
}
if (!class_exists('GetTaxResult')) {
require VMAVALARA_CLASS_PATH . DS . 'GetTaxResult.class.php';
}
if (!class_exists('Address')) {
require VMAVALARA_CLASS_PATH . DS . 'Address.class.php';
}
if (is_object($calc)) {
$calc = get_object_vars($calc);
}
$request = new GetTaxRequest();
$origin = new Address();
//In Virtuemart we have not differenct warehouses, but we have a shipment address
//So when the vendor has a shipment address, we assume that it is his warehouse
//Later we can combine products with shipment addresses for different warehouse (yehye, future music)
//But for now we just use the BT address
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($calc['virtuemart_vendor_id']);
$userModel = VmModel::getModel('user');
$virtuemart_userinfo_id = $userModel->getBTuserinfo_id($userId);
// this is needed to set the correct user id for the vendor when the user is logged
$userModel->getVendor($calc['virtuemart_vendor_id']);
$vendorFieldsArray = $userModel->getUserInfoInUserFields('mail', 'BT', $virtuemart_userinfo_id, FALSE, TRUE);
$vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id];
$origin->setLine1($vendorFields['fields']['address_1']['value']);
$origin->setLine2($vendorFields['fields']['address_2']['value']);
$origin->setCity($vendorFields['fields']['city']['value']);
$origin->setCountry($vendorFields['fields']['virtuemart_country_id']['country_2_code']);
$origin->setRegion($vendorFields['fields']['virtuemart_state_id']['state_2_code']);
$origin->setPostalCode($vendorFields['fields']['zip']['value']);
$request->setOriginAddress($origin);
//Address
if (isset($this->addresses[0])) {
$destination = $this->addresses[0];
} else {
return FALSE;
}
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
$calculator = calculationHelper::getInstance();
$request->setCurrencyCode($calculator->_currencyDisplay->_vendorCurrency_code_3);
//CurrencyCode
$request->setDestinationAddress($destination);
//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
//.........这里部分代码省略.........
示例2: foreach
//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) {
echo " Line: " . $ctl->getNo() . " Tax: " . $ctl->getTax() . " TaxCode: " . $ctl->getTaxCode() . "\n";
foreach ($ctl->getTaxDetails() as $ctd) {
示例3: 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();
}
示例4: getTax
//.........这里部分代码省略.........
// Your Company Code From the Dashboard
if ($calc->committ and $sale) {
$request->setDocType(DocumentType::$SalesInvoice);
// Only supported types are SalesInvoice or SalesOrder
$request->setCommit(true);
//invoice number, problem is that the invoice number is at this time not known, but the order_number may reachable
$request->setDocCode($committ);
vmdebug('Request as SalesInvoice with invoiceNumber ' . $committ);
} else {
$request->setDocType(DocumentType::$SalesOrder);
$request->setCommit(false);
//invoice number, problem is that the invoice number is at this time not known, neither the order_number
$request->setDocCode('VM2.0.16_order_request');
vmdebug('Request as SalesOrder');
}
$request->setDocDate(date('Y-m-d'));
//date
//$request->setSalespersonCode(""); // string Optional
$request->setCustomerCode($shopperData['customer_id']);
//string Required
if (isset($shopperData['tax_usage_type'])) {
$request->setCustomerUsageType($shopperData['tax_usage_type']);
//string Entity Usage
}
$cartPrices = $calculationHelper->getCartPrices();
//vmdebug('$cartPrices',$cartPrices);
$request->setDiscount($cartPrices['discountAmount']);
//decimal
//$request->setDiscount(0.0);
// $request->setPurchaseOrderNo(""); //string Optional
//If I understand correctly, we need to add for this an userfield, for example with the name
//exemption_no, then user could enter their number.
if (isset($shopperData['tax_exemption_number'])) {
$request->setExemptionNo($shopperData['tax_exemption_number']);
//string if not using ECMS which keys on customer code
}
$request->setDetailLevel('Tax');
//Summary or Document or Line or Tax or Diagnostic
// $request->setReferenceCode1(""); //string Optional
// $request->setReferenceCode2(""); //string Optional
// $request->setLocationCode(""); //string Optional - aka outlet id for tax forms
/////////////////////////////////////////
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
$cart = VirtueMartCart::getCart();
$products = array();
if ($calculationHelper->inCart) {
$products = $cart->products;
$prices = $calculationHelper->getCartPrices();
foreach ($products as $k => $product) {
if (!empty($prices[$k]['discountedPriceWithoutTax'])) {
$price = $prices[$k]['discountedPriceWithoutTax'];
} else {
if (!empty($prices[$k]['basePriceVariant'])) {
$price = $prices[$k]['basePriceVariant'];
} else {
vmdebug('There is no price in getTax for product ' . $k . ' ', $prices);
$price = 0.0;
}
}
$product->price = $price;
if (!empty($price[$k]['discountAmount'])) {
$product->discount = $price[$k]['discountAmount'];
} else {
$product->discount = FALSE;
示例5: 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
//.........这里部分代码省略.........