agriya/webshoptaxation

此包最新版本(dev-master)没有可用的许可证信息。

dev-master 2014-05-21 08:00 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:36:15 UTC


README

此包用于管理网站国家和产品的税费。您可以通过调用一些简单的函数轻松管理税费。

安装

  1. 通过在您的根目录的 composer.json 中添加以下行来安装此包

    "require": { ... ... "agriya/webshoptaxation": "dev"

    },

    然后运行 "composer update"

2, 在包加载后,将以下行添加到 app/conifg/app.php 中的 'providers' 数组中,如下所示

'providers' => array(
	...
	...
	'Agriya\Webshoptaxation\WebshoptaxationServiceProvider',
}
  1. 然后从您的根目录运行以下迁移命令以在您的数据库中创建表。这将为您创建两个表

    对于发布的包,运行 php artisan migrate --package=Agriya/Webshoptaxation

    对于工作台包,运行 php artisan migrate --bench=Agriya/Webshoptaxation

    注意:运行这些命令需要在您的根目录(即 composer.json 放置的位置)中运行

安装完成。 :)

使用方法

运输列表

Webshoptaxation::Taxations()->getTaxations([array $array, string $return_type]);

参数

$array(必需) 数组可以包含 'id' 或 'user_id' 作为元素。如果传递 'id',则返回特定的税费详细信息。如果传递 'user_id',则返回指定用户的全部税费详细信息。

$return(可选) 这可以是 'list' 或 'all'。默认为 'list')

				'list'	This will return the result as "id" and "tax name" combination
				'firs'	This will return first result with all fields from taxations table
				'all' 	This will return all the fields from taxations table for the given condition

示例

Webshoptaxation::Taxations()->getTaxations(array('user_id'=>1), 'all');

	This will return all taxations details of the user id 1 from taxations table 

Webshoptaxation::Taxations()->getTaxations(array('user_id'=>1), 'list');

	This will return the list ('id' => 'tax_name') combination for all taxations details for the user id 1 from taxations table 

Webshoptaxation::Taxations()->getTaxations(array('id'=>10), 'first');	

	This will return single taxations details for the id 10 from taxations table 

添加税费详细信息

	$inputs = array(
		'user_id' 	=> 1,
		'tax_name' 	=> 'VAT',
		'tax_description' 	=> 'Value added tax',
		'tax_fee' 	=> '14.5',
		'fee_type'	=> 'percentage',
	);
	$taxatonid = Webshoptaxation::Taxations()->addTaxation($inputs);

更新税费详细信息

	$inputs = array(
		'tax_name' 	=> 'VAT',
		'tax_description' 	=> 'Value Added Tax',
		'tax_fee' 	=> '10',
		'fee_type'	=> 'flat',
	);

	$taxatonid = Webshoptaxation::Taxations()->updateTaxation(1, $inputs);

删除税费详细信息

	$taxatonid = Webshoptaxation::Taxations()->deleteTaxation(1);

产品税费费用

获取产品税费费用列表

$inputs = array( 'product_id' => $product_id, ); $producttaxatonslist = Webshoptaxation::ProductTaxations()->getProductTaxations($inputs);

添加产品税费费用列表

$inputs = array( 'taxation_id' => 2, 'product_id' => 1, 'tax_fee' => '14.5', 'fee_type' => 'percentage', ); $producttaxatonid = Webshoptaxation::ProductTaxations()->addProductTaxation($inputs);

更新产品税费费用列表

	Update based on id
	-------------------
			$inputs = array(
				'tax_fee' 	=> '5',
				'fee_type'	=> 'flat',
			);

			$taxatonid = Webshoptaxation::ProductTaxations()->updateProductTaxation(1, $inputs);

	Update based on conditions
	--------------------------
			$inputs = array(
				'tax_fee' 	=> '5',
				'fee_type'	=> 'flat',
			);

			$conditions = array(
				'product_id' => 1,
				'taxation_id' => 2
			);

			$taxatonid = Webshoptaxation::ProductTaxations()->updateProductTaxation(null, $inputs, $conditions);

删除产品税费费用列表

	Delete based on id
	-------------------
			$inputs = array(
				'tax_fee' 	=> '5',
				'fee_type'	=> 'flat',
			);
		
			$taxatonid = Webshoptaxation::ProductTaxations()->deleteProductTaxation(1);

	Delete based on conditions
	--------------------------
			$inputs = array(
				'tax_fee' 	=> '5',
				'fee_type'	=> 'flat',
			);

			$conditions = array(
				'product_id' => 1,
				'taxation_id' => 2
			);
			$taxatonid = Webshoptaxation::ProductTaxations()->deleteProductTaxation(null, $conditions);