agriya/webshoptaxation

There is no license information available for the latest version (dev-master) of this package.

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

This package is not auto-updated.

Last update: 2024-11-09 17:19:27 UTC


README

This package is to manage the taxation fee for the countries and product in the site. You can manage taxatopm fees easily by calling some easy function

Instatllation

  1. Install the package by add the following line in composer.json of your root directory

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

    },

    And then run "composer update"

2, After the package loaded add this line to app/conifg/app.php in the 'providers' array as like follows

'providers' => array(
	...
	...
	'Agriya\Webshoptaxation\WebshoptaxationServiceProvider',
}
  1. After that run the following migrations commands from your root directory to create the tables in ur database. This will create you two tables

    For published package php artisan migrate --package=Agriya/Webshoptaxation

    For workbench package php artisan migrate --bench=Agriya/Webshoptaxation

    Note: run these commands needs to be run from your root directory (where the composer.json has placed)

Thats it of installation. :)

Usage

Shipments list

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

Parameters

$array(required) Array can have either 'id' or 'user_id' as element. If 'id' is passed, then the specific taxatiion detail will be returned. If 'user_id' is passed, then all taxatiion details of the specified user will be returned.

$return(optional) This can be either 'list' or 'all'. (default is '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

Example

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 

Add Taxation Details

	$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);

Update Taxation Details

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

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

Delete Taxation Details

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

Product Taxation Fees

Get Product Taxation Fees List

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

Add Product Taxation Fees List

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

Update Product Taxation Fees List

	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 Product Taxation Fees List

	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);