Commit 163a9696 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

First working version

parents
Material
sql
BASE=eurecap
PLUGINTYPE=vmextended
VERSION=0.1
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
# $(BASE)/
MVCFILES=controllers/ models/ views/
SYSTRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).*sys.ini)
NONSYSTRANSLATIONS=${SYSTRANSLATIONS:%.sys.ini=%.ini}
TRANSLATIONS=$(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) $(call wildcard,language/*/index.html) language/index.html
FIELDS=$(call wildcard,fields/*.php)
ZIPFILE=plg_$(PLUGINTYPE)_$(BASE)_v$(VERSION).zip
all: zip
$(NONSYSTRANSLATIONS): %.ini: %.sys.ini
cp $< $@
zip: $(PLUGINFILES) $(TRANSLATIONS) $(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS)
@echo "Packing all files into distribution file $(ZIPFILE):"
@zip -r $(ZIPFILE) $(PLUGINFILES) $(MVCFILES) $(TRANSLATIONS) $(FIELDS)
clean:
rm -f $(ZIPFILE)
<?php
if( !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
*
* @version
* @package VirtueMart
* @subpackage EU Recapitulative Statement
* @copyright Copyright (C) 2015 Open Tools, Reinhold Kainhofer.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://www.open-tools.net
*/
if(!class_exists('VmController'))require(VMPATH_ADMIN.DS.'helpers'.DS.'vmcontroller.php');
/**
* Report Controller
*
* @package VirtueMart
* @subpackage Report
* @author Open Tools, Reinhold Kainhofer
*/
class VirtuemartControllerEuRecap extends VmController {
/**
* Report Controller Constructor
*/
function __construct(){
parent::__construct();
// Add the proper view pathes...
$this->addViewPath(JPATH_PLUGINS.DS . 'vmextended' . DS . 'eurecap' . DS . 'views');
}
function settings($layout='settings'){
vRequest::setVar('controller', $this->_cname);
vRequest::setVar('view', $this->_cname);
vRequest::setVar('layout', $layout);
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView($this->_cname, $viewType);
$view->setLayout($layout);
$this->display();
}
function export($layout='csv'){
vRequest::setVar('controller', $this->_cname);
vRequest::setVar('view', $this->_cname);
vRequest::setVar('layout', $layout);
// $this->addViewPath(VMPATH_ADMIN . DS . 'views');
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView($this->_cname, $viewType);
$view->setLayout($layout);
$this->display();
}
/**
* Handle the save task
*/
function save($data = 0){
vRequest::vmCheckToken();
$data = vRequest::getPost();
$model = VmModel::getModel('eurecap_config');
$model->saveConfig($data);
$msg = vmText::_('COM_VIRTUEMART_CONFIG_SAVED');
$redir = $this->redirectPath;
if(vRequest::getCmd('task') == 'apply'){
$redir = $redir . '&task=settings';
}
$this->setRedirect($redir, $msg);
}
}
// pure php no closing tag
\ No newline at end of file
<?php
if( !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* Abstract class for extended plugins
* This class provides some standard methods that can implemented to add features into the VM core
* Be sure to include this line in the plugin file:
* require(VMPATH_ADMIN.DS.'helpers'.DS.'vmextendedplugin.php');
*
* @package VirtueMart
* @subpackage Plugins
* @author Christopher Roussel
*/
if (!class_exists('vmExtendedPlugin')) require(VMPATH_PLUGINLIBS . DS . 'vmextendedplugin.php');
class plgVmExtendedEuRecap extends vmExtendedPlugin {
public function __construct (&$subject, $config=array()) {
parent::__construct($subject, $config);
$this->_path = JPATH_PLUGINS.DS.'vmextended'.DS.$this->getName();
JPlugin::loadLanguage('plg_vmextended_'.$this->getName());
}
// public function getVmPluginCreateTableSQL () {
// }
/* In versions before VM 2.6.8, the onStoreInstallPluginTable function was protected, so the installer couldn't call it to create the plugin table...
This function simply is a public wrapper to make this function available to the installer on all VM versions: */
public function plgVmOnStoreInstallPluginTable($psType, $name='') {
return $this->onStoreInstallPluginTable($psType, $name);
}
/**
* Plugs into the backend controller logic to insert a custom controller into the VM component space
* This means that links can be constructed as index.php?option=com_virtuemart&view=myaddon and work
*
* @param string $controller Name of controller requested
* @return True if this loads a file (null otherwise)
*/
public function onVmAdminController ($controller) {
if ($controller = 'eurecap') {
VmModel::addIncludePath($this->_path . DS . 'models');
// TODO: Make sure the model exists. We probably should find a better way to load this automatically!
// Currently, some path config seems missing, so the model is not found by default.
require_once($this->_path.DS.'models'.DS.'eurecap.php');
require_once($this->_path.DS.'models'.DS.'eurecap_config.php');
require_once($this->_path.DS.'controllers'.DS.'eurecap.php');
return true;
}
}
/**
* The onVmAdminMenuItems($moduleId) trigger is supposed to return an array of admin menu entries, each of which has the following structure:
* array('module_id'=>1, 'module_name'=>'product', 'module_perms'=>'storeadmin,admin',
* 'id'=>..., 'name'=>'COM_VIRTUEMART_PRODUCT_S', 'link'=>'', 'depends'=>'', 'icon_class'=>'vmicon vmicon-16-camera',
* 'view'=>'YOURVIEW', 'task'=>'', 'module_ordering'=>1, 'item_ordering'=>3)
*/
public function onVmAdminMenuItems($moduleId=0) {
return array(
array('module_id'=>14,
'module_name'=>'report',
'module_perms'=>'storeadmin,admin',
'id'=>100877,
'name'=>'COM_VIRTUEMART_EU_RECAP',
'link'=>'',
'depends'=>'',
'icon_class'=>'vmicon vmicon-16-report',
'view'=>'eurecap',
'task'=>'',
'module_ordering'=>4,
'item_ordering'=>25,
),
);
}
}
\ No newline at end of file
<?php
defined('_JEXEC') or die('Restricted access');
/**
* Installation script for the plugin
*
* @copyright Copyright (C) 2013-2014 Reinhold Kainhofer, office@open-tools.net
* @license GPL v3+, http://www.gnu.org/copyleft/gpl.html
*/
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists( 'VmConfig' ))
require(JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');
class plgVmExtendedEuRecapInstallerScript
{
/**
* Constructor
*
* @param JAdapterInstance $adapter The object responsible for running this script
*/
// public function __constructor(JAdapterInstance $adapter);
/**
* Called before any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install)
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
// public function preflight($route, JAdapterInstance $adapter);
/**
* Called after any type of action
*
* @param string $route Which action is happening (install|update|uninstall|discover_install)
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function postflight ($type, $parent = null) {
// if(!class_exists( 'vmPlugin' ))
// require JPATH_VM_ADMINISTRATOR.DS.'plugins'.DS.'vmplugin.php';
// if(!class_exists( 'plgVmShopperOrdernumber' ))
// require JPATH_ROOT.DS.'plugins'.DS.'vmextended'.DS.'eurecap'.DS.'eurecap.php';
// $dispatcher = new JDispatcher();
// $config = array('name' => 'eurecap', 'type' => 'vmextended');
// $plugin = new plgVmExtendedEuRecap($dispatcher, $config);
// $plugin->plgVmOnStoreInstallPluginTable('extended');
// // $dispatcher->trigger("plgVmOnStoreInstallPluginTable", array('vmshopper'));
}
/**
* Called on installation
*
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function install(JAdapterInstance $adapter)
{
// enabling plugin
$db = JFactory::getDBO();
$db->setQuery('update #__extensions set enabled = 1 where type = "plugin" and element = "eurecap" and folder = "vmextended"');
$db->query();
return True;
}
/**
* Called on update
*
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function update(JAdapterInstance $adapter)
{
// jimport( 'joomla.filesystem.file' );
// $file = JPATH_ROOT . DS . "administrator" . DS . "language" . DS . "en-GB" . DS . "en-GB.plg_vmshopper_ordernumber.sys.ini";
// if (JFile::exists($file)) JFile::delete($file);
// $file = JPATH_ROOT . DS . "administrator" . DS . "language" . DS . "de-DE" . DS . "de-DE.plg_vmshopper_ordernumber.sys.ini";
// if (JFile::exists($file)) JFile::delete($file);
return true;
}
/**
* Called on uninstallation
*
* @param JAdapterInstance $adapter The object responsible for running this script
*/
public function uninstall(JAdapterInstance $adapter)
{
// // Remove plugin table
// $db =& JFactory::getDBO();
// $db->setQuery('DROP TABLE IF EXISTS `#__virtuemart_shopper_plg_ordernumber`;');
// $db->query();
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<extension version="2.5" type="plugin" group="vmextended" method="upgrade">
<name>VMEXT_EU_RECAP</name>
<creationDate>2015-01-09</creationDate>
<author>Open Tools</author>
<authorEmail>office@open-tools.net</authorEmail>
<authorUrl>http://www.open-tools.net/</authorUrl>
<copyright>Copyright (C) 2015 Reinhold Kainhofer. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license>
<version>0.1</version>
<releaseDate>2015-04-01</releaseDate>
<releaseType>Initial Release</releaseType>
<downloadUrl>http://www.open-tools.net</downloadUrl>
<description>VMEXT_EU_RECAP_DESC</description>
<files>
<filename plugin="eurecap">eurecap.php</filename>
<filename>eurecap.script.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>controllers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<scriptfile>eurecap.script.php</scriptfile>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_vmextended_eurecap.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_vmextended_eurecap.sys.ini</language>
</languages>
<vmconfig>
<fields name="settings" addfieldpath="/administrator/components/com_virtuemart/fields">
<fieldset name="order_properties" addfieldpath="/plugins/vmextended/eurecap/fields" label="VMEXT_EU_RECAP_ORDERPROPERTIES">
<field name="order_status" type="orderstatus" default="C,S" multiple="multiple" label="VMEXT_EU_RECAP_ORDERSTATUS" description="VMEXT_EU_RECAP_ORDERSTATUS_DESC "/>
<field name="shopper_groups" type="vmshoppergroups" multiple="multiple" label="VMEXT_EU_RECAP_SHOPPERGROUP" description="VMEXT_EU_RECAP_SHOPPERGROUP_DESC" />
<field name="vatid_userfield" type="vmuserfields" label="VMEXT_EU_RECAP_VATID_USERFIELD" multiple="multiple" default="opc_vat" description="VMEXT_EU_RECAP_VATID_USERFIELD_DESC" />
<field name="only_untaxed" type="radio" default="1" class="btn-group btn-group-yesno" label="VMEXT_EU_RECAP_UNTAXED" description="VMEXT_EU_RECAP_UNTAXED_DESC" >
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset name="report_settings" addfieldpath="/plugins/vmextended/eurecap/fields" label="VMEXT_EU_RECAP_REPORTSETTINGS">
<field name="frequency" type="list" default="1" label="VMEXT_EU_RECAP_FREQUENCY" description="VMEXT_EU_RECAP_FREQUENCY_DESC" >
<option value="1">VMEXT_EU_RECAP_FREQUENCY_MONTHLY</option>
<option value="3">VMEXT_EU_RECAP_FREQUENCY_QUARTERLY</option>
<option value="12">VMEXT_EU_RECAP_FREQUENCY_YEARLY</option>
</field>
<field name="countries" type="vmcountries" multiple="true" scope="com_virtuemart" default="" label="VMEXT_EU_RECAP_COUNTRIES" description="VMEXT_EU_RECAP_COUNTRIES_DESC"/>
<field name="taxation_moment" type="list" default="status" label="VMEXT_EU_RECAP_TAXATION_MOMENT" description="VMEXT_EU_RECAP_TAXATION_MOMENT_DESC" >
<option value="placement">VMEXT_EU_RECAP_TAXATION_MOMENT_PLACEMENT</option>
<!-- <option value="status">VMEXT_EU_RECAP_TAXATION_MOMENT_STATUSCHANGE</option> -->
<!-- <option value="payment">VMEXT_EU_RECAP_TAXATION_MOMENT_PAYMENT</option> -->
<option value="invoice">VMEXT_EU_RECAP_TAXATION_MOMENT_INVOICE</option>
</field>
<field name="taxnr" type="text" scope="com_virtuemart" default="" label="VMEXT_EU_RECAP_TAXNR" description="VMEXT_EU_RECAP_TAXNR_DESC"/>
</fieldset>
</fields>
</vmconfig>
</extension>
<?php
defined('_JEXEC') or die();
/**
*
* @package VirtueMart
* @subpackage Plugins - Elements
* @author Valérie Isaksen
* @link http://www.virtuemart.net
* @copyright ${PHING.VM.COPYRIGHT}
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id$
*/
JFormHelper::loadFieldClass('list');
jimport('joomla.form.formfield');
if (!class_exists( 'VmConfig' ))
require(JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');
VmConfig::loadConfig();
class JFormFieldVmShopperGroups extends JFormFieldList {
/**
* The form field type.
*
* @var string
* @since 11.1
*/
var $type = 'vmShopperGroups';
protected function getOptions() {
VmConfig::loadJLang('com_virtuemart_orders', TRUE);
$options = array();
$db = JFactory::getDBO();
$query = 'SELECT `virtuemart_shoppergroup_id` AS value, `shopper_group_name` AS text
FROM `#__virtuemart_shoppergroups`
WHERE `virtuemart_vendor_id` = 1
ORDER BY `ordering` ASC, `virtuemart_shoppergroup_id` ASC ';
$db->setQuery($query);
$values = $db->loadObjectList();
foreach ($values as $value) {
$options[] = JHtml::_('select.option', $value->value, vmText::_($value->text));
}
return $options;
}
}
\ No newline at end of file
<?php
defined('_JEXEC') or die();
/**
*
* @package VirtueMart
* @subpackage Plugins - Userfields Form Field
* @author Reinhold Kainhofer, Open Tools
* @link http://www.open-tools.net
* @copyright Copyright (c) 2015 Reinhold Kainhofer. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
class JFormFieldVmUserFields extends JFormFieldList {
var $_name = 'vmUserFields';
protected function getOptions() {
$model = VmModel::getModel('userfields');
$userfields = $model->getUserfieldsList();
$options = array();
foreach ($userfields as $field) {
$options[] = JHtml::_ ('select.option', $field->name, JText::_($field->title) . " (" . $field->name . ")");
}
return $options;
}
}
\ No newline at end of file
<!DOCTYPE html><title></title>
VMEXT_EU_RECAP="EU Recapitulative Statement"
VMEXT_EU_RECAP_DESC="A plugin to automatically create EU Recapitulative Statements for untaxed cross-border EU sales to businesses with a valid EU VAT ID."
COM_VIRTUEMART_REPORT_MOD="Reports"
COM_VIRTUEMART_EU_RECAP="EU Recapitulative Statement"
; COM_VIRTUEMART_EU_RECAP="EU Recapitulative Statement"
VMEXT_EU_RECAP_SETTINGS_TITLE="Configuration of the EU Recapitulative Statement"
VMEXT_EU_RECAP_VIEW_TITLE_DATE="EU Recapitulative Statement for the period from %s to %s"
VMEXT_EU_RECAP_LIST_MONTH="Period"
VMEXT_EU_RECAP_LIST_YEAR="Year"
VMEXT_EU_RECAP_RECHECK_EUVATID="(Re-)Check EU VAT IDs"
VMEXT_EU_RECAP_SETTINGS="Settings"
VMEXT_EU_RECAP_EXPORT="Export"
VMEXT_EU_RECAP_FORM_NOTFOUND="Configuration form not available"
VMEXT_EU_RECAP_ORDERPROPERTIES="Order Properties for Inclusion in the Report"
VMEXT_EU_RECAP_ORDERSTATUS="Order Status"
VMEXT_EU_RECAP_ORDERSTATUS_DESC="Only orders with one of the selected statuses will be included in the recapitulative statement. If none are selected, all orders will possibly be included, depending on the other required properties."
VMEXT_EU_RECAP_SHOPPERGROUP="Shopper Groups"
VMEXT_EU_RECAP_SHOPPERGROUP_DESC="Only orders by users of the selected shopper groups will be included in the recapitulative statement. If none are selected, all orders will possibly be included, depending on the other required properties."
VMEXT_EU_RECAP_VATID_USERFIELD="The user field(s) that holds the EU VAT ID of the customer."
VMEXT_EU_RECAP_VATID_USERFIELD_DESC="An order can only be included if the customer is a EU-based business with a valid EU VAT ID. This number will usually be stored in a configurable user field. If the plugin to handle EU VAT IDs has changed in the past, select all user fields that were used."
VMEXT_EU_RECAP_UNTAXED="Include only untaxed sales."
VMEXT_EU_RECAP_UNTAXED_DESC="Select whether all orders are included or only orders where no tax (neither at product-level nor at order-level) was charged."
VMEXT_EU_RECAP_REPORTSETTINGS="General Settings for the Recapitulative Report"
VMEXT_EU_RECAP_FREQUENCY="Frequency of the Report"
VMEXT_EU_RECAP_FREQUENCY_DESC="Select how often you are required to submit a recapitulative report. Only time periods for the selected frequency will be offered in the report page."
VMEXT_EU_RECAP_FREQUENCY_MONTHLY="Monthly"
VMEXT_EU_RECAP_FREQUENCY_QUARTERLY="Quarterly"
VMEXT_EU_RECAP_FREQUENCY_YEARLY="Yearly"
VMEXT_EU_RECAP_COUNTRIES="Countries"
VMEXT_EU_RECAP_COUNTRIES_DESC="Only orders by customers from of the selected countries will be included in the recapitulative statement. Typically, all EU countries except your home country should be selected."
VMEXT_EU_RECAP_TAXATION_MOMENT="Moment of taxation"
VMEXT_EU_RECAP_TAXATION_MOMENT_DESC="Select the point in time when a new order actually causes a tax liability."
VMEXT_EU_RECAP_TAXATION_MOMENT_PLACEMENT="When the order is initially created in VirtueMart."
VMEXT_EU_RECAP_TAXATION_MOMENT_STATUSCHANGE="When the order is first changed to any of the order statuses selected above."
VMEXT_EU_RECAP_TAXATION_MOMENT_PAYMENT="When payment is made."
VMEXT_EU_RECAP_TAXATION_MOMENT_INVOICE="When the invoice is created."
VMEXT_EU_RECAP_TAXNR="Your tax number"
VMEXT_EU_RECAP_TAXNR_DESC="When exporting to xml or csv, some countries require the tax number of the vendor to be included in the file. If this is the case for your tax authority, please enter your tax number here so the generated files can be automatically processed by your tax authority."
VMEXT_EU_RECAP_VATID="EU VAT ID"
VMEXT_EU_RECAP_COUNTRYCODE="Billing Country"
VMEXT_EU_RECAP_COMPANY="Company Name"
VMEXT_EU_RECAP_NAME="Person"
VMEXT_EU_RECAP_ORDERS="Orders"
VMEXT_EU_RECAP_ORDERTOTALS="Total revenue"
VMEXT_EU_RECAP_ORDERTAXES="Taxes"
\ No newline at end of file
VMEXT_EU_RECAP="EU Recapitulative Statement"
VMEXT_EU_RECAP_DESC="A plugin to automatically create EU Recapitulative Statements for untaxed cross-border EU sales to businesses with a valid EU VAT ID."
COM_VIRTUEMART_REPORT_MOD="Reports"
COM_VIRTUEMART_EU_RECAP="EU Recapitulative Statement"
; COM_VIRTUEMART_EU_RECAP="EU Recapitulative Statement"
VMEXT_EU_RECAP_SETTINGS_TITLE="Configuration of the EU Recapitulative Statement"
VMEXT_EU_RECAP_VIEW_TITLE_DATE="EU Recapitulative Statement for the period from %s to %s"
VMEXT_EU_RECAP_LIST_MONTH="Period"
VMEXT_EU_RECAP_LIST_YEAR="Year"
VMEXT_EU_RECAP_RECHECK_EUVATID="(Re-)Check EU VAT IDs"
VMEXT_EU_RECAP_SETTINGS="Settings"
VMEXT_EU_RECAP_EXPORT="Export"
VMEXT_EU_RECAP_FORM_NOTFOUND="Configuration form not available"
VMEXT_EU_RECAP_ORDERPROPERTIES="Order Properties for Inclusion in the Report"
VMEXT_EU_RECAP_ORDERSTATUS="Order Status"
VMEXT_EU_RECAP_ORDERSTATUS_DESC="Only orders with one of the selected statuses will be included in the recapitulative statement. If none are selected, all orders will possibly be included, depending on the other required properties."
VMEXT_EU_RECAP_SHOPPERGROUP="Shopper Groups"
VMEXT_EU_RECAP_SHOPPERGROUP_DESC="Only orders by users of the selected shopper groups will be included in the recapitulative statement. If none are selected, all orders will possibly be included, depending on the other required properties."
VMEXT_EU_RECAP_VATID_USERFIELD="The user field(s) that holds the EU VAT ID of the customer."
VMEXT_EU_RECAP_VATID_USERFIELD_DESC="An order can only be included if the customer is a EU-based business with a valid EU VAT ID. This number will usually be stored in a configurable user field. If the plugin to handle EU VAT IDs has changed in the past, select all user fields that were used."
VMEXT_EU_RECAP_UNTAXED="Include only untaxed sales."
VMEXT_EU_RECAP_UNTAXED_DESC="Select whether all orders are included or only orders where no tax (neither at product-level nor at order-level) was charged."
VMEXT_EU_RECAP_REPORTSETTINGS="General Settings for the Recapitulative Report"
VMEXT_EU_RECAP_FREQUENCY="Frequency of the Report"
VMEXT_EU_RECAP_FREQUENCY_DESC="Select how often you are required to submit a recapitulative report. Only time periods for the selected frequency will be offered in the report page."
VMEXT_EU_RECAP_FREQUENCY_MONTHLY="Monthly"
VMEXT_EU_RECAP_FREQUENCY_QUARTERLY="Quarterly"
VMEXT_EU_RECAP_FREQUENCY_YEARLY="Yearly"
VMEXT_EU_RECAP_COUNTRIES="Countries"
VMEXT_EU_RECAP_COUNTRIES_DESC="Only orders by customers from of the selected countries will be included in the recapitulative statement. Typically, all EU countries except your home country should be selected."
VMEXT_EU_RECAP_TAXATION_MOMENT="Moment of taxation"
VMEXT_EU_RECAP_TAXATION_MOMENT_DESC="Select the point in time when a new order actually causes a tax liability."
VMEXT_EU_RECAP_TAXATION_MOMENT_PLACEMENT="When the order is initially created in VirtueMart."
VMEXT_EU_RECAP_TAXATION_MOMENT_STATUSCHANGE="When the order is first changed to any of the order statuses selected above."
VMEXT_EU_RECAP_TAXATION_MOMENT_PAYMENT="When payment is made."
VMEXT_EU_RECAP_TAXATION_MOMENT_INVOICE="When the invoice is created."
VMEXT_EU_RECAP_TAXNR="Your tax number"
VMEXT_EU_RECAP_TAXNR_DESC="When exporting to xml or csv, some countries require the tax number of the vendor to be included in the file. If this is the case for your tax authority, please enter your tax number here so the generated files can be automatically processed by your tax authority."
VMEXT_EU_RECAP_VATID="EU VAT ID"
VMEXT_EU_RECAP_COUNTRYCODE="Billing Country"
VMEXT_EU_RECAP_COMPANY="Company Name"
VMEXT_EU_RECAP_NAME="Person"
VMEXT_EU_RECAP_ORDERS="Orders"
VMEXT_EU_RECAP_ORDERTOTALS="Total revenue"
VMEXT_EU_RECAP_ORDERTAXES="Taxes"
\ No newline at end of file
<!DOCTYPE html><title></title>
<?php
if (!defined ('_JEXEC')) {
die('Direct Access to ' . basename (__FILE__) . ' is not allowed.');
}
/**
*
* EU Recapitulative Statement Model
*
* @author Reinhold Kainhofer
* @version $Id$
* @package VirtueMart
* @subpackage EU Recapitulative Statement
* @copyright Copyright (C) 2011 - 2014VirtueMart Team - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://www.open-tools.net
*/
if (!class_exists ('VmModel')) {
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'vmmodel.php');
}
class VirtuemartModelEuRecap extends VmModel {
public $from_date = '';
public $until_date = '';
protected $frequency = 3;
function __construct () {
parent::__construct ();
$this->setMainTable ('orders');
$app = JFactory::getApplication ();
// $this->setPeriod ();
$this->removevalidOrderingFieldName ('virtuemart_order_id');
$this->addvalidOrderingFieldName (array('`vatid`', '`order_ids`', '`company`', '`last_name`', '`countrycode`', '`sum_order_total`', '`sum_order_tax`'));
$this->_selectedOrdering = '`vatid`';
}
function getFrequency() {
return $this->frequency;
}
function setFrequency($freq = 3) {
$this->frequency = $freq;
}
function correctTimeOffset(&$inputDate) {
$config = JFactory::getConfig();