Esempio n. 1
0
 function showTaxes(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $record = $request->get('record');
     $recordModule = $request->get('recordModule');
     $currency = $request->get('currency');
     $sourceRecord = $request->get('sourceRecord');
     $taxType = $request->get('taxType');
     $totalPrice = $request->get('totalPrice');
     $inventoryModel = Vtiger_Inventory_Model::getInstance($moduleName);
     $accountTaxs = $inventoryModel->getAccountTax($moduleName, $sourceRecord);
     $config = $inventoryModel->getTaxesConfig();
     $viewer = $this->getViewer($request);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('RECORD', $record);
     $viewer->assign('RECORD_MODULE', $recordModule);
     $viewer->assign('GLOBAL_TAXS', $inventoryModel->getGlobalTaxs());
     $viewer->assign('CURRENCY_SYMBOL', Vtiger_Functions::getCurrencySymbolandRate($currency)['symbol']);
     $viewer->assign('TOTAL_PRICE', $totalPrice);
     $viewer->assign('CONFIG', $config);
     $viewer->assign('TAX_TYPE', $taxType);
     $viewer->assign('TAX_FIELD', Vtiger_InventoryField_Model::getTaxField($recordModule));
     $viewer->assign('AGGREGATION_TYPE', $config['aggregation']);
     $viewer->assign('AGGREGATION_INPUT_TYPE', $config['aggregation'] == 0 ? 'radio' : 'checkbox');
     $viewer->assign('GROUP_TAXS', $accountTaxs['taxs']);
     $viewer->assign('ACCOUNT_NAME', $accountTaxs['name']);
     echo $viewer->view('InventoryTaxes.tpl', $moduleName, true);
 }
Esempio n. 2
0
 public function setInventory(Vtiger_Request $request)
 {
     $param = $request->get('param');
     $moduleName = $param['module'];
     $status = false;
     $inventoryInstance = Vtiger_Inventory_Model::getInstance($moduleName);
     $status = $inventoryInstance->setInventoryTable($param['status']);
     if ($status) {
         $status = true;
     }
     $response = new Vtiger_Response();
     $response->setResult(['success' => $status]);
     $response->emit();
 }
Esempio n. 3
0
 /**
  * Check whether this field is active
  * @param array $row Field entry from the database
  * @return boolean
  */
 public function isActiveField($row)
 {
     if (in_array($row['suptype'], ['Discount', 'DiscountMode'])) {
         $discountsConfig = Vtiger_Inventory_Model::getDiscountsConfig();
         if ($discountsConfig['active'] == '0') {
             return false;
         }
     }
     return true;
 }
Esempio n. 4
0
	/**
	 * Get tax configuration
	 * @return array config data
	 */
	public static function getTaxesConfig()
	{
		if (self::$taxsConfig != false) {
			return self::$taxsConfig;
		}

		$db = PearDatabase::getInstance();
		$config = [];
		$result = $db->query('SELECT * FROM a_yf_taxes_config');
		while ($row = $db->fetch_array($result)) {
			$value = $row['value'];
			if (in_array($row['param'], ['taxs'])) {
				$value = explode(',', $value);
			}
			$config[$row['param']] = $value;
		}
		self::$taxsConfig = $config;
		return $config;
	}