-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84108dd
commit 24ba9cd
Showing
6 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
framework/modules/ecommerce/controllers/taxController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?php | ||
|
||
################################################## | ||
# | ||
# Copyright (c) 2004-2011 OIC Group, Inc. | ||
# Created by Adam Kessler @ 05/28/2008 | ||
# | ||
# This file is part of Exponent | ||
# | ||
# Exponent is free software; you can redistribute | ||
# it and/or modify it under the terms of the GNU | ||
# General Public License as published by the Free | ||
# Software Foundation; either version 2 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# GPL: http://www.gnu.org/licenses/gpl.txt | ||
# | ||
################################################## | ||
|
||
class taxController extends expController { | ||
public $basemodel_name = 'taxclass'; | ||
|
||
//protected $permissions = array_merge(array("test"=>'Test'), array('copyProduct'=>"Copy Product")); | ||
//protected $add_permissions = array(); | ||
public $useractions = null; // keeps it from showing up in available modules to activate | ||
|
||
function name() { return $this->displayname(); } //for backwards compat with old modules | ||
function displayname() { return "e-Commerce Tax Class Manager"; } | ||
function description() { return "Manage tax classes for your Ecommerce store"; } | ||
function author() { return "OIC Group, Inc"; } | ||
function hasSources() { return true; } | ||
function hasViews() { return true; } | ||
function hasContent() { return true; } | ||
function supportsWorkflow() { return false; } | ||
function isSearchable() { return true; } | ||
function canImportData() { return true; } | ||
function canExportData() { return true; } | ||
|
||
function manage() { | ||
global $db; | ||
|
||
expHistory::set('managable', $this->params); | ||
|
||
$sql = " | ||
SELECT | ||
exponent_tax_class.id, | ||
exponent_tax_zone.`name` AS zonename, | ||
exponent_tax_rate.rate as rate, | ||
exponent_tax_class.`name` AS classname, | ||
exponent_geo_country.`name` as country, | ||
exponent_geo_region.`name` as state | ||
FROM exponent_tax_class INNER JOIN exponent_tax_rate ON exponent_tax_class.id = exponent_tax_rate.class_id | ||
INNER JOIN exponent_tax_zone ON exponent_tax_rate.zone_id = exponent_tax_zone.id | ||
INNER JOIN exponent_tax_geo ON exponent_tax_geo.zone_id = exponent_tax_zone.id | ||
INNER JOIN exponent_geo_country ON exponent_tax_geo.country_id = exponent_geo_country.id | ||
INNER JOIN exponent_geo_region ON exponent_tax_geo.region_id = exponent_geo_region.id | ||
"; | ||
|
||
$taxes = $db->selectObjectsBySql($sql); | ||
|
||
assign_to_template(array('taxes'=>$taxes)); | ||
} | ||
|
||
function manage_zones() { | ||
global $db; | ||
|
||
expHistory::set('managable', $this->params); | ||
|
||
$sql = " | ||
SELECT | ||
* | ||
FROM exponent_tax_zone ORDER BY name ASC; | ||
"; | ||
|
||
$zones = $db->selectObjectsBySql($sql); | ||
|
||
assign_to_template(array('zones'=>$zones)); | ||
} | ||
|
||
function edit_zone() { | ||
global $db; | ||
|
||
$sql = " | ||
SELECT | ||
* | ||
FROM exponent_tax_zone ORDER BY name ASC; | ||
"; | ||
|
||
$zones = $db->selectObjectsBySql($sql); | ||
|
||
assign_to_template(array('zones'=>$zones)); | ||
} | ||
|
||
function update_zone() { | ||
global $db; | ||
$obj->name = $this->params['name']; | ||
$db->insertObject($obj,'tax_zone'); | ||
expHistory::back(); | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{* | ||
* Copyright (c) 2007-2008 OIC Group, Inc. | ||
* Written and Designed by Adam Kessler | ||
* | ||
* This file is part of Exponent | ||
* | ||
* Exponent is free software; you can redistribute | ||
* it and/or modify it under the terms of the GNU | ||
* General Public License as published by the Free | ||
* Software Foundation; either version 2 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* GPL: http://www.gnu.org/licenses/gpl.txt | ||
* | ||
*} | ||
|
||
{form action=update} | ||
{control type="hidden" name="id" value=$record->id} | ||
{control type="text" name="name" label="Class Name" value=$record->classname} | ||
{control type="text" name="rate" label="Rate" value=$record->rate} | ||
{control type="dropdown" name="zone" label="Zone" values=$record->zones default=$record->zonename} | ||
{control type=state name=state label="State/Province" value=$record->state} | ||
{control type=country name=country label="Country" value=$record->country} | ||
|
||
{control type="buttongroup" submit="Submit" cancel="Cancel"} | ||
{/form} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{* | ||
* Copyright (c) 2007-2008 OIC Group, Inc. | ||
* Written and Designed by Adam Kessler | ||
* | ||
* This file is part of Exponent | ||
* | ||
* Exponent is free software; you can redistribute | ||
* it and/or modify it under the terms of the GNU | ||
* General Public License as published by the Free | ||
* Software Foundation; either version 2 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* GPL: http://www.gnu.org/licenses/gpl.txt | ||
* | ||
*} | ||
|
||
{form action=update_zone} | ||
{control type="hidden" name="id" value=$record->id} | ||
{control type="text" name="name" label="Zone Name" value=$record->zone} | ||
|
||
{control type="buttongroup" submit="Submit" cancel="Cancel"} | ||
{/form} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{* | ||
* Copyright (c) 2007-2008 OIC Group, Inc. | ||
* Written and Designed by Adam Kessler | ||
* | ||
* This file is part of Exponent | ||
* | ||
* Exponent is free software; you can redistribute | ||
* it and/or modify it under the terms of the GNU | ||
* General Public License as published by the Free | ||
* Software Foundation; either version 2 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* GPL: http://www.gnu.org/licenses/gpl.txt | ||
* | ||
*} | ||
|
||
{css unique="tax" corecss="tables"} | ||
|
||
{/css} | ||
|
||
<h1>{"Tax Class Manager"|gettext}</h1> | ||
|
||
{icon action=edit class="add" text="Add a Tax Class"} | ||
{icon action=manage_zones class="manage" text="Manage Zones"} | ||
{br} | ||
{br} | ||
<table border="0" cellspacing="0" cellpadding="0" class="exp-skin-table"> | ||
<thead> | ||
<tr> | ||
<th> | ||
Class | ||
</th> | ||
<th> | ||
Rate | ||
</th> | ||
<th> | ||
Zone | ||
</th> | ||
<th> | ||
State | ||
</th> | ||
<th> | ||
Country | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{foreach from=$taxes item=tax key=key name=taxes} | ||
<tr class="{cycle values="odd,even"}"> | ||
<td> | ||
{$tax->classname} | ||
</td> | ||
<td> | ||
{$tax->rate|number_format:2}% | ||
</td> | ||
<td> | ||
{$tax->zonename} | ||
</td> | ||
<td> | ||
{$tax->state} | ||
</td> | ||
<td> | ||
{$tax->country} | ||
</td> | ||
</tr> | ||
{/foreach} | ||
</tbody> | ||
</table> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{* | ||
* Copyright (c) 2007-2008 OIC Group, Inc. | ||
* Written and Designed by Adam Kessler | ||
* | ||
* This file is part of Exponent | ||
* | ||
* Exponent is free software; you can redistribute | ||
* it and/or modify it under the terms of the GNU | ||
* General Public License as published by the Free | ||
* Software Foundation; either version 2 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* GPL: http://www.gnu.org/licenses/gpl.txt | ||
* | ||
*} | ||
|
||
{css unique="tax" corecss="tables"} | ||
|
||
{/css} | ||
|
||
<h1>{"Tax Zone Manager"|gettext}</h1> | ||
|
||
{icon action=edit_zone class="add" text="Add a Tax Zone"} | ||
{br} | ||
{br} | ||
<table border="0" cellspacing="0" cellpadding="0" class="exp-skin-table"> | ||
<thead> | ||
<tr> | ||
<th style="width:50px"> | ||
| ||
</th> | ||
<th> | ||
Name | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{foreach from=$zones item=zone key=key name=zones} | ||
<tr class="{cycle values="odd,even"}"> | ||
<td> | ||
{icon action=edit_zone record=$zone img="edit.png"} | ||
{icon action=delete record=$zone img="delete.png"} | ||
</td> | ||
<td> | ||
{$zone->name} | ||
</td> | ||
</tr> | ||
{/foreach} | ||
</tbody> | ||
</table> | ||
|