Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Loader)
- *
- * @ Version : 2.0.0.4
- * @ Author : DeZender
- * @ Release on : 21.10.2015
- * @ Official site : http://DeZender.Net
- *
- */
- function CommissionsManager_config() {
- require_once "functions.php";
- $defaultcurrency = CommissionsManager_GetDefaultCurrency();
- $clientsgroups = CommissionsManager_GetClientsGroups();
- if ($clientsgroups)
- {
- $clientsgroups = "," . implode(",", $clientsgroups);
- }
- $apiusers = CommissionsManager_GetWHMCSAPIUsers();
- $apiusers = implode(",", $apiusers);
- $configarray = array("name" => "Commissions Manager", "version" => "1.0.3", "author" => "<a href=\"http://www.katamaze.com/r/h\" target=\"_blank\" title=\"katamaze.com\"><img src=\"../modules/addons/CommissionsManager/images/katamaze.png\"></a>", "description" => "Pay commissions to your salespersons for bringing in new customers and new orders. You can define commissions based on a fixed rate, percentage or both, one-time or recurring basis and link them to orders, products, invoices, renewals or even entire accounts. It's all automatically handled by the module that also gives you a nice interface where you can see all statistics and your return of investment for every salepersons.", "language" => "english", "fields" => array("licensekey" => array("FriendlyName" => "License key", "Type" => "text", "Size" => "25", "Description" => "Insert the license key that you have been issued via email", "Default" => ""), "salesgroup" => array("FriendlyName" => "Salespersons", "Description" => "You can define, if you want to, a specific group of salespersons", "Type" => "dropdown", "Size" => "10", "Default" => "0|All clients", "Options" => "0|All clients" . $clientsgroups . ""), "recurringcycles" => array("FriendlyName" => "Cycles for recurring commissions", "Description" => "Enter a progressive comma-separated list of months that you want to use as recurring cycles", "Type" => "text", "Size" => "25", "Default" => "1,3,6,12,24,32,48"), "automaticcheckout" => array("FriendlyName" => "Automatic checkouts", "Description" => "Enable if you want the module to automatically checkout commissions in according to your checkout rules", "Type" => "dropdown", "Size" => "10", "Default" => "Disabled", "Options" => "Disabled,Enabled"), "minimumamount" => array("FriendlyName" => "Minimum amount", "Description" => $defaultcurrency["suffix"] . " required for automatic checkouts (0 to disable)", "Type" => "text", "Size" => "5", "Default" => "0"), "dropcommissionstime" => array("FriendlyName" => "Drop commissions after", "Description" => "days (0 to disable)", "Type" => "text", "Size" => "5", "Default" => "0"), "apiuser" => array("FriendlyName" => "API username", "Description" => "specify the user that you want to use to perform API actions. It's used only for logging purposes", "Type" => "dropdown", "Size" => "10", "Options" => $apiusers)));
- return $configarray;
- }
- function CommissionsManager_activate() {
- mysql_query("CREATE TABLE IF NOT EXISTS `mod_cmaccount` (`id` int(11) NOT NULL AUTO_INCREMENT, `salesperson` int(11) NOT NULL, `client` int(11) NOT NULL, `type` varchar(255) NOT NULL, `base` char(255) NOT NULL, `value` decimal(10,2) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
- mysql_query("CREATE TABLE IF NOT EXISTS `mod_cmcommissions` (`id` int(11) NOT NULL AUTO_INCREMENT, `salesperson` int(11) NOT NULL, `client` int(11) NOT NULL, `refid` int(11) NOT NULL, `type` varchar(255) NOT NULL, `percentage` decimal(10,2) NOT NULL, `fixed` decimal(10,2) NOT NULL, `cycle` int(11) NOT NULL, `description` text NOT NULL, `autorecalculate` tinyint(1) DEFAULT NULL, `amount` decimal(10,2) NOT NULL, `date` date NOT NULL, `status` text NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
- mysql_query("CREATE TABLE IF NOT EXISTS `mod_cmtransactions` (`id` int(11) NOT NULL AUTO_INCREMENT, `salesperson` int(11) NOT NULL, `client` int(11) NOT NULL, `refid` int(11) NOT NULL, `percentage` decimal(10,2) NOT NULL, `fixed` decimal(10,2) NOT NULL, `reason` char(255) NOT NULL, `description` text NOT NULL, `commission` decimal(10,2) NOT NULL, `income` decimal(10,2) NOT NULL, `balance` decimal(10,2) NOT NULL, `roi` decimal(10,2) NOT NULL, `status` varchar(255) NOT NULL, `currencycode` text NOT NULL, `currencyrate` decimal(10,5) NOT NULL, `date` datetime NOT NULL, PRIMARY KEY (`id`), KEY `userid` (`salesperson`,`reason`,`date`,`status`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
- mysql_query("INSERT INTO `tbladdonmodules` (`module`, `setting`, `value`) VALUES ('CommissionsManager', 'localkey', '');");
- return;
- }
- function CommissionsManager_deactivate() {
- mysql_query("DROP TABLE `mod_cmaccount`");
- mysql_query("DROP TABLE `mod_cmcommissions`");
- mysql_query("DROP TABLE `mod_cmtransactions`");
- return;
- }
- function CommissionsManager_output($vars) {
- require_once "functions.php";
- if (!$_GET["view"])
- {
- $_GET["view"] = "summary";
- }
- $smarty = new Smarty();
- $smarty->caching = false;
- $smarty->assign("modulelink", $vars["modulelink"]);
- $smarty->assign("_ADDONLANG", $vars["_lang"]);
- $smarty->assign("_GET", $_GET);
- $smarty->assign("_POST", $_POST);
- $smarty->compile_dir = $GLOBALS["templates_compiledir"];
- $results = CommissionsManager_CheckLicense($vars["licensekey"], $vars["localkey"]);
- if ($results["status"] == "Active")
- {
- if (!$_POST["nor"])
- {
- $_POST["nor"] = "50";
- }
- $_POST["filter"] = array_filter($_POST["filter"]);
- if (!$_POST["filter"])
- {
- unset($_POST["filter"]);
- }
- $whmcsversion = CommissionsManager_WHMCSSimpleVersion(CommissionsManager_GetWHMCSConf("Version"));
- $smarty->assign("whmcsversion", $whmcsversion);
- if ($_GET["view"] == "summary")
- {
- if (!is_dir("../modules/addons/CommissionsManager/js/highcharts"))
- {
- $highcharts = false;
- }
- else
- {
- $highcharts = true;
- }
- $smarty->assign("stats", CommissionsManager_GetStats());
- $smarty->assign("currency", CommissionsManager_GetDefaultCurrency());
- $smarty->assign("highcharts", $highcharts);
- $smarty->display(dirname(__FILE__) . "/templates/header.tpl");
- $smarty->display(dirname(__FILE__) . "/templates/summary.tpl");
- $smarty->display(dirname(__FILE__) . "/templates/footer.tpl");
- }
- else
- {
- if ($_GET["view"] == "addonetimecommission")
- {
- if ($_POST["confirm"] == "yes")
- {
- ....................................................................
- ..................................
- .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement