Advertisement
Guest User

Untitled

a guest
Mar 30th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.50 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Loader)
  6. *
  7. * @ Version : 2.0.0.4
  8. * @ Author : DeZender
  9. * @ Release on : 21.10.2015
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function CommissionsManager_config() {
  15.  
  16. require_once "functions.php";
  17. $defaultcurrency = CommissionsManager_GetDefaultCurrency();
  18. $clientsgroups = CommissionsManager_GetClientsGroups();
  19. if ($clientsgroups)
  20. {
  21. $clientsgroups = "," . implode(",", $clientsgroups);
  22. }
  23. $apiusers = CommissionsManager_GetWHMCSAPIUsers();
  24. $apiusers = implode(",", $apiusers);
  25. $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)));
  26. return $configarray;
  27. }
  28.  
  29. function CommissionsManager_activate() {
  30.  
  31. 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;");
  32. 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;");
  33. 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;");
  34. mysql_query("INSERT INTO `tbladdonmodules` (`module`, `setting`, `value`) VALUES ('CommissionsManager', 'localkey', '');");
  35. return;
  36. }
  37.  
  38. function CommissionsManager_deactivate() {
  39.  
  40. mysql_query("DROP TABLE `mod_cmaccount`");
  41. mysql_query("DROP TABLE `mod_cmcommissions`");
  42. mysql_query("DROP TABLE `mod_cmtransactions`");
  43. return;
  44. }
  45.  
  46. function CommissionsManager_output($vars) {
  47.  
  48. require_once "functions.php";
  49. if (!$_GET["view"])
  50. {
  51. $_GET["view"] = "summary";
  52. }
  53. $smarty = new Smarty();
  54. $smarty->caching = false;
  55. $smarty->assign("modulelink", $vars["modulelink"]);
  56. $smarty->assign("_ADDONLANG", $vars["_lang"]);
  57. $smarty->assign("_GET", $_GET);
  58. $smarty->assign("_POST", $_POST);
  59. $smarty->compile_dir = $GLOBALS["templates_compiledir"];
  60. $results = CommissionsManager_CheckLicense($vars["licensekey"], $vars["localkey"]);
  61. if ($results["status"] == "Active")
  62. {
  63. if (!$_POST["nor"])
  64. {
  65. $_POST["nor"] = "50";
  66. }
  67. $_POST["filter"] = array_filter($_POST["filter"]);
  68. if (!$_POST["filter"])
  69. {
  70. unset($_POST["filter"]);
  71. }
  72. $whmcsversion = CommissionsManager_WHMCSSimpleVersion(CommissionsManager_GetWHMCSConf("Version"));
  73. $smarty->assign("whmcsversion", $whmcsversion);
  74. if ($_GET["view"] == "summary")
  75. {
  76. if (!is_dir("../modules/addons/CommissionsManager/js/highcharts"))
  77. {
  78. $highcharts = false;
  79. }
  80. else
  81. {
  82. $highcharts = true;
  83. }
  84. $smarty->assign("stats", CommissionsManager_GetStats());
  85. $smarty->assign("currency", CommissionsManager_GetDefaultCurrency());
  86. $smarty->assign("highcharts", $highcharts);
  87. $smarty->display(dirname(__FILE__) . "/templates/header.tpl");
  88. $smarty->display(dirname(__FILE__) . "/templates/summary.tpl");
  89. $smarty->display(dirname(__FILE__) . "/templates/footer.tpl");
  90. }
  91. else
  92. {
  93. if ($_GET["view"] == "addonetimecommission")
  94. {
  95. if ($_POST["confirm"] == "yes")
  96. {
  97. ....................................................................
  98. ..................................
  99. .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement