本文整理汇总了PHP中Line::setTaxOverride方法的典型用法代码示例。如果您正苦于以下问题:PHP Line::setTaxOverride方法的具体用法?PHP Line::setTaxOverride怎么用?PHP Line::setTaxOverride使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line::setTaxOverride方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateTaxRequestForTaxOverrideType
private function CreateTaxRequestForTaxOverrideType($docCode)
{
$request = new GetTaxRequest();
$request->setCompanyCode("DEFAULT");
$request->setDocCode($docCode);
$request->setDocType(DocumentType::$PurchaseOrder);
$dateTime = new DateTime();
$docDate = date_format($dateTime, "Y-m-d");
$request->setDocDate($docDate);
$request->setCustomerCode("TaxSvcTest");
$request->setSalespersonCode("");
$request->setDetailLevel(DetailLevel::$Tax);
$origin = new Address();
$origin->setAddressCode("Origin");
$origin->setCity("Denver");
$origin->setRegion("CO");
$origin->setPostalCode("80216-1022");
$origin->setCountry("USA");
$request->setOriginAddress($origin);
$destination = new Address();
$destination->setAddressCode("Dest");
$destination->setLine1("11051 S Parker Rd");
$destination->setCity("Parker");
$destination->setRegion("CO");
$destination->setPostalCode("80134-7441");
$destination->setCountry("USA");
$request->setDestinationAddress($destination);
$line = new Line();
$line->setNo("1");
$line->setQty(1);
$line->setAmount(0);
$taxOverride = new TaxOverride();
$taxOverride->setTaxOverrideType(TaxOverrideType::$AccruedTaxAmount);
$taxOverride->setTaxAmount(21.1);
$taxOverride->setReason("Accrued");
$line->setTaxOverride($taxOverride);
$request->setLines(array($line));
return $request;
}
示例2: createStandardRequest
function createStandardRequest($calc, $products, $sign = 1)
{
if (!class_exists('TaxServiceSoap')) {
require VMAVALARA_CLASS_PATH . '/TaxServiceSoap.class.php';
}
if (!class_exists('DocumentType')) {
require VMAVALARA_CLASS_PATH . '/DocumentType.class.php';
}
if (!class_exists('DetailLevel')) {
require VMAVALARA_CLASS_PATH . '/DetailLevel.class.php';
}
if (!class_exists('Line')) {
require VMAVALARA_CLASS_PATH . '/Line.class.php';
}
if (!class_exists('ServiceMode')) {
require VMAVALARA_CLASS_PATH . '/ServiceMode.class.php';
}
if (!class_exists('Line')) {
require VMAVALARA_CLASS_PATH . '/Line.class.php';
}
if (!class_exists('GetTaxRequest')) {
require VMAVALARA_CLASS_PATH . '/GetTaxRequest.class.php';
}
if (!class_exists('GetTaxResult')) {
require VMAVALARA_CLASS_PATH . '/GetTaxResult.class.php';
}
if (!class_exists('Address')) {
require VMAVALARA_CLASS_PATH . '/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 . '/models/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 . '/helpers/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']);
}
if (isset($products['discountAmount'])) {
if (!empty($products['discountAmount'])) {
$request->setDiscount($sign * $products['discountAmount'] * -1);
//decimal
}
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) {
//.........这里部分代码省略.........