Esempio n. 1
0
function hook_project_management_adminticketinfo($vars)
{
    global $aInt;
    global $jscode;
    global $jquerycode;
    $ticketid = $vars['ticketid'];
    $ticketdata = get_query_vals("tbltickets", "userid,title,tid", array("id" => $ticketid));
    $tid = $ticketdata['tid'];
    require ROOTDIR . "/modules/addons/project_management/project_management.php";
    $projectrows = "";
    $result = select_query("mod_project", "mod_project.*,(SELECT CONCAT(firstname,' ',lastname) FROM tbladmins WHERE id=mod_project.adminid) AS adminname", "ticketids LIKE '%" . mysql_real_escape_string($tid) . "%'");
    while ($data = mysql_fetch_array($result)) {
        $timerid = get_query_val("mod_projecttimes", "id", array("projectid" => $data['id'], "end" => "", "adminid" => $_SESSION['adminid']), "start", "DESC");
        $timetrackinglink = $timerid ? "<a href=\"#\" onclick=\"projectendtimer('" . $data['id'] . "');return false\"><img src=\"../modules/addons/project_management/images/notimes.png\" align=\"absmiddle\" border=\"0\" /> Stop Tracking Time</a>" : "<a href=\"#\" onclick=\"projectstarttimer('" . $data['id'] . "');return false\"><img src=\"../modules/addons/project_management/images/starttimer.png\" align=\"absmiddle\" border=\"0\" /> Start Tracking Time</a>";
        $projectrows .= "<tr><td><a href=\"addonmodules.php?module=project_management&m=view&projectid=" . $data['id'] . "\">" . $data['id'] . "</a></td><td><a href=\"addonmodules.php?module=project_management&m=view&projectid=" . $data['id'] . "\">" . $data['title'] . "</a> <span id=\"projecttimercontrol" . $data['id'] . "\" class=\"tickettimer\">" . $timetrackinglink . "</span></td><td>" . $data['adminname'] . "</td><td>" . fromMySQLDate($data['created']) . "</td><td>" . fromMySQLDate($data['duedate']) . "</td><td>" . fromMySQLDate($data['lastmodified']) . "</td><td>" . $data['status'] . "</td></tr>";
    }
    $code = "<link href=\"../modules/addons/project_management/css/style.css\" rel=\"stylesheet\" type=\"text/css\" />\n\n<div id=\"projectscont\" style=\"margin:0 0 10px 0;padding:5px;border:2px dashed #e0e0e0;background-color:#fff;-moz-border-radius: 6px;-webkit-border-radius: 6px;-o-border-radius: 6px;border-radius: 6px;" . ($projectrows ? "" : "display:none;") . "\">\n\n<h2 style=\"margin:0 0 5px 0;text-align:center;background-color:#f2f2f2;-moz-border-radius: 6px;-webkit-border-radius: 6px;-o-border-radius: 6px;border-radius: 6px;\">Projects</h2>\n\n<div class=\"tablebg\" style=\"padding:0 20px;\">\n<table class=\"datatable\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" id=\"ticketprojectstbl\">\n<tr><th>Project ID</th><th>Title</th><th>Assigned To</th><th>Created</th><th>Due Date</th><th>Last Updated</th><th>Status</th></tr>\n" . $projectrows . "\n</table>\n</div>\n\n</div>\n\n";
    if (project_management_checkperm("Create New Projects")) {
        $code .= "<span style=\"float:right;padding:0 50px 15px 0;\"><a href=\"#\" onclick=\"createnewproject();return false\" class=\"create\"><img src=\"images/icons/add.png\" align=\"top\" border=\"0\" /> <b>Create New Project</b></a></span>";
    }
    $code .= "\n<script>\n\$(document).on(\"keyup\",\"#cpclientname\",function () {\n\tvar ticketuseridsearchlength = \$(\"#cpclientname\").val().length;\n\tif (ticketuseridsearchlength>2) {\n\t\$.post(\"search.php\", { ticketclientsearch: 1, value: \$(\"#cpclientname\").val() },\n\t    function(data){\n            if (data) {\n                \$(\"#cpticketclientsearchresults\").html(data.replace(\"searchselectclient(\",\"projectsearchselectclient(\"));\n                \$(\"#cpticketclientsearchresults\").slideDown(\"slow\");\n                \$(\"#cpclientsearchcancel\").fadeIn();\n            }\n        });\n\t}\n});\nfunction projectsearchselectclient(userid,name,email) {\n    \$(\"#cpclientname\").val(name);\n    \$(\"#cpuserid\").val(userid);\n    \$(\"#cpclientsearchcancel\").fadeOut();\n\t\$(\"#cpticketclientsearchresults\").slideUp(\"slow\");\n}\n\nfunction createnewproject() {\n\t\$(\"#popupcreatenew\").show();\n\t\$(\"#popupstarttimer\").hide();\n\t\$(\"#popupendtimer\").hide();\n\t\$(\"#createnewcont\").slideDown();\n}\nfunction createproject() {\n\tinputs = \$(\"#ajaxcreateprojectform\").serializeArray();\n\t\$.post(\"addonmodules.php?module=project_management&createproj=1&ajax=1\", { input : inputs },\n\t\tfunction (data) {\n\t\t\tif(data == \"0\"){\n\t\t\t\talert(\"You do not have permission to create project\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n                \$(\"#ticketprojectstbl\").append(data);\n\t\t\t\t\$(\"#projectscont\").slideDown();\n\t\t\t}\n\t\t});\n}\n\nfunction projectstarttimer(projectid) {\n    \$(\"#ajaxstarttimerformprojectid\").val(projectid);\n\t\$(\"#popupcreatenew\").hide();\n\t\$(\"#popupstarttimer\").show();\n\t\$(\"#popupendtimer\").hide();\n\t\$(\"#createnewcont\").slideDown();\n}\n\nfunction projectendtimer(projectid) {\n\t\$(\"#popupcreatenew\").hide();\n\t\$(\"#popupstarttimer\").hide();\n\t\$(\"#popupendtimer\").show();\n\t\$(\"#createnewcont\").slideDown();\n}\n\nfunction projectstarttimersubmit() {\n\t\$.post(\"addonmodules.php?module=project_management&m=view\", \"a=hookstarttimer&\"+\$(\"#ajaxstarttimerform\").serialize(),\n\t\tfunction (data) {\n\t\t\tif(data == \"0\"){\n\t\t\t\talert(\"Could not start timer.\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n                var projid = \$(\"#ajaxstarttimerformprojectid\").val();\n\t\t\t\t\$(\"#projecttimercontrol\"+projid).html(\"<a href=\"//\" onclick=\"projectendtimer('\"+projid+\"');return false\"><img src=\"../modules/addons/project_management/images/notimes.png\" align=\"absmiddle\" border=\"0\" /> Stop Tracking Time</a>\");\n\t\$(\"#activetimers\").html(data);\n\t\t\t}\n\t\t});\n}\nfunction projectendtimersubmit(projectid,timerid) {\n\t\$.post(\"addonmodules.php?module=project_management&m=view\", \"a=hookendtimer&timerid=\"+timerid+\"&ticketnum=" . $tid . "\",\n\t\tfunction (data) {\n\t\t\tif (data == \"0\") {\n\t\t\t\talert(\"Could not stop timer.\");\n\t\t\t} else {\n\t\t\t\t\$(\"#createnewcont\").slideUp();\n\t\t\t\t\$(\"#projecttimercontrol\"+projectid).html(\"<a href=\"//\" onclick=\"projectstarttimer('\"+projectid+\"');return false\"><img src=\"../modules/addons/project_management/images/starttimer.png\" align=\"absmiddle\" border=\"0\" /> Start Tracking Time</a>\");\n\t\t\$(\"#activetimers\").html(data);\n\t\t\t}\n\t\t});\n}\n\nfunction projectpopupcancel() {\n\t\$(\"#createnewcont\").slideUp();\n}\n\n</script>\n\n<div class=\"projectmanagement\">\n\n<div id=\"createnewcont\" style=\"display:none;\">\n\n<div class=\"createnewcont2\">\n\n<div class=\"createnewproject\" id=\"popupcreatenew\" style=\"display:none\">\n<div class=\"title\">Create New Project</div>\n<form id=\"ajaxcreateprojectform\">\n<div class=\"label\">Title</div>\n<input type=\"text\" name=\"title\" class=\"title\" />\n<div class=\"float\">\n<div class=\"label\">Created</div>\n<input type=\"text\" name=\"created\" class=\"datepick\" value=\"" . getTodaysDate() . "\" />\n</div>\n<div class=\"float\">\n<div class=\"label\">Due Date</div>\n<input type=\"text\" name=\"duedate\" class=\"datepick\" value=\"" . getTodaysDate() . "\" />\n</div>\n<div class=\"float\">\n<div class=\"label\">Assigned To</div>\n<select class=\"title\" name=\"adminid\">";
    $code .= "<option value=\"0\">None</option>";
    $result = select_query("tbladmins", "id,firstname,lastname", "", "firstname` ASC,`lastname", "ASC");
    while ($data = mysql_fetch_array($result)) {
        $aid = $data['id'];
        $adminfirstname = $data['firstname'];
        $adminlastname = $data['lastname'];
        $code .= "<option value=\"" . $aid . "\"";
        if ($aid == $adminid) {
            $code .= " selected";
        }
        $code .= ">" . $adminfirstname . " " . $adminlastname . "</option>";
    }
    $code .= "</select>\n</div>\n<div class=\"float\">\n<div class=\"label\">Ticket #</div>\n<input type=\"text\" name=\"ticketnum\" class=\"ticketnum\" value=\"" . $tid . "\" />\n</div>\n<div class=\"clear\"></div>\n<div class=\"float\">\n<div class=\"label\">Associated Client</div>\n<input type=\"hidden\" name=\"userid\" id=\"cpuserid\" /><input type=\"text\" id=\"cpclientname\" value=\"" . $clientname . "\" class=\"title\" onfocus=\"if(this.value=='" . addslashes($clientname) . "')this.value=''\" /> <img src=\"images/icons/delete.png\" alt=\"" . $vars['_lang']['cancel'] . "\" align=\"right\" id=\"clientsearchcancel\" height=\"16\" width=\"16\"><div id=\"cpticketclientsearchresults\" style=\"z-index:2000;\"></div>\n</div>\n<br /><br />\n<div align=\"center\"><input type=\"button\" value=\"Create\" onclick=\"createproject()\" class=\"create\" /> <input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n\n<div class=\"createnewproject\" id=\"popupstarttimer\" style=\"display:none\">\n<div class=\"title\">Start Time Tracking</div>\n<form id=\"ajaxstarttimerform\">\n<input type=\"hidden\" id=\"ajaxstarttimerformprojectid\" name=\"projectid\">\n<input type=\"hidden\" name=\"ticketnum\" value=\"" . $tid . "\" />\n<div class=\"label\">Select Existing Task</div>\n<select class=\"title\" style=\"min-width:450px\" name=\"taskid\">";
    $code .= "<option value=\"\">Choose one...</option>";
    $result = select_query("mod_projecttasks", "mod_project.title, mod_projecttasks.id, mod_projecttasks.projectid, mod_projecttasks.task", array("mod_project.ticketids" => array("sqltype" => "LIKE", "value" => (int) $tid)), "", "", "", "mod_project ON mod_projecttasks.projectid=mod_project.id", "", "", "", "mod_project ON mod_projecttasks.projectid=mod_project.id");
    while ($data = mysql_fetch_array($result)) {
        $code .= "<option value=\"" . $data['id'] . "\"";
        $code .= ">" . $data['projectid'] . " - " . $data['title'] . " - " . $data['task'] . "</option>";
    }
    $code .= "</select><br />\n<div class=\"label\">Or Create New Task</div>\n<input type=\"text\" name=\"title\" class=\"title\" />\n<br />\n<div align=\"center\"><input type=\"button\" value=\"Start\" onclick=\"projectstarttimersubmit();return false\" class=\"create\" /> <input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n</div>\n\n<div class=\"createnewproject\" id=\"popupendtimer\" style=\"display:none\">\n<div class=\"title\">Stop Time Tracking</div>\n<form id=\"ajaxendtimerform\">\n<input type=\"hidden\" id=\"ajaxendtimerformprojectid\" name=\"projectid\">\n<br />\n<b>Active Timers</b>:<br /><br />\n<div id=\"activetimers\">\n";
    $result = select_query("mod_projecttimes", "mod_projecttimes.id, mod_projecttimes.projectid, mod_project.title, mod_projecttimes.taskid, mod_projecttasks.task, mod_projecttimes.start", array("mod_projecttimes.adminid" => $_SESSION['adminid'], "mod_projecttimes.end" => "", "mod_project.ticketids" => array("sqltype" => "LIKE", "value" => (int) $tid)), "", "", "", "mod_projecttasks ON mod_projecttimes.taskid=mod_projecttasks.id INNER JOIN mod_project ON mod_projecttimes.projectid=mod_project.id");
    while ($data = mysql_fetch_array($result)) {
        $code .= "<div class=\"stoptimer" . $data['id'] . "\" style=\"padding-bottom:10px;\"><em>" . $data['title'] . " - Project ID " . $data['projectid'] . "</em><br />&nbsp;&raquo; " . $data['task'] . "<br />Started at " . fromMySQLDate(date("Y-m-d H:i:s", $data['start']), 1) . ":" . date("s", $data['start']) . " - <a href=\"#\" onclick=\"projectendtimersubmit('" . $data['projectid'] . "','" . $data['id'] . "');return false\"><strong>Stop Timer</strong></a></div>";
    }
    $code .= "\n</div>\n<br />\n<div align=\"center\"><input type=\"button\" value=\"Cancel\" class=\"create\" onclick=\"projectpopupcancel();return false\" /></div>\n</form>\n</div>\n\n</div>\n\n</div>\n\n";
    return $code;
}
Esempio n. 2
0
<?php

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}
$reportdata["title"] = "Ticket Tags Overview";
$reportdata["description"] = "This report provides an overview of ticket tags assigned to tickets for a given date range";
if (!$fromdate) {
    $fromdate = fromMySQLDate(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, date("d"), date("Y"))));
}
if (!$todate) {
    $todate = getTodaysDate();
}
$reportdata["headertext"] = "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "?report={$report}\"><center>Start Date: <input type=\"text\" name=\"fromdate\" value=\"{$fromdate}\" class=\"datepick\" /> &nbsp;&nbsp;&nbsp; End Date: <input type=\"text\" name=\"todate\" value=\"{$todate}\" class=\"datepick\" /> &nbsp;&nbsp;&nbsp; <input type=\"submit\" value=\"Generate Report\" /></form>";
$reportdata["tableheadings"][] = "Tag";
$reportdata["tableheadings"][] = "Count";
$result = full_query("SELECT `tag`, COUNT(*) AS `count` FROM `tbltickettags` INNER JOIN tbltickets ON tbltickets.id=tbltickettags.ticketid WHERE tbltickets.date>='" . db_make_safe_human_date($fromdate) . " 00:00:00' AND tbltickets.date<='" . db_make_safe_human_date($todate) . " 23:59:59' GROUP BY tbltickettags.tag ORDER BY `count` DESC");
while ($data = mysql_fetch_array($result)) {
    $tag = $data[0];
    $count = $data[1];
    $reportdata["tablevalues"][] = array($tag, $count);
    $chartdata['rows'][] = array('c' => array(array('v' => $tag), array('v' => (int) $count, 'f' => $count)));
}
$chartdata['cols'][] = array('label' => 'Tag', 'type' => 'string');
$chartdata['cols'][] = array('label' => 'Count', 'type' => 'number');
$args = array();
$args['legendpos'] = 'right';
$reportdata["headertext"] .= $chart->drawChart('Pie', $chartdata, $args, '300px');
Esempio n. 3
0
    $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ":";
    $seconds = intval($sec % 60);
    $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
    return $hms;
}
if (!defined("WHMCS")) {
    exit("This file cannot be accessed directly");
}
require ROOTDIR . "/includes/clientfunctions.php";
$reportdata['title'] = "Project Management Summary";
$reportdata['description'] = "This report shows a summary of all projects with times logged betwen";
if (!$datefrom) {
    $datefrom = fromMySQLDate(date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"))));
}
if (!$dateto) {
    $dateto = getTodaysDate();
}
$statusdropdown = "<select name=\"status\"><option value=\"\">- Any -</option>";
$statuses = get_query_val("tbladdonmodules", "value", array("module" => "project_management", "setting" => "statusvalues"));
$statuses = explode(",", $statuses);
foreach ($statuses as $statusx) {
    $statusx = explode("|", $statusx, 2);
    $statusdropdown .= "<option";
    if ($statusx[0] == $status) {
        $statusdropdown .= " selected";
    }
    $statusdropdown .= ">" . $statusx[0] . "</option>";
}
$statusdropdown .= "</status>";
$admindropdown = "<select name=\"adminid\"><option value=\"0\">- Any -</option>";
$result = select_query("tbladmins", "id,firstname,lastname", "", "firstname` ASC,`lastname", "ASC");
Esempio n. 4
0
     }
     $recur = $data['recur'];
     $recurcycle = $data['recurcycle'];
     $recurfor = $data['recurfor'];
     $invoiceaction = $data['invoiceaction'];
     $invoicecount = $data['invoicecount'];
     $duedate = fromMySQLDate($data['duedate']);
 } else {
     $pagetitle = $aInt->lang("billableitems", "additem");
     $clientcheck = get_query_val("tblclients", "id", "");
     if (!$clientcheck) {
         $aInt->gracefulExit($aInt->lang("billableitems", "noclientsmsg"));
     }
     $invoiceaction = 0;
     $recur = 0;
     $duedate = getTodaysDate();
     $hours = "0.0";
     $amount = "0.00";
     $invoicecount = 0;
     $options = "";
     $result = select_query("tblproducts", "tblproducts.id,tblproducts.gid,tblproducts.name,tblproductgroups.name AS groupname", "", "tblproductgroups`.`order` ASC,`tblproducts`.`order` ASC,`name", "ASC", "", "tblproductgroups ON tblproducts.gid=tblproductgroups.id");
     while ($data = mysql_fetch_array($result)) {
         $pid = $data['id'];
         $pname = $data['name'];
         $ptype = $data['groupname'];
         $options .= "<option value=\"" . $pid . "\"";
         if ($package == $pid) {
             $options .= " selected";
         }
         $options .= ">" . $ptype . " - " . $pname . "</option>";
     }
Esempio n. 5
0
    }
    echo "<strong>" . $aInt->lang("services", "bwusage") . ":</strong> " . $bwusage . " " . $aInt->lang("fields", "mb") . ", <strong>" . $aInt->lang("services", "bwlimit") . ":</strong> " . $bwlimit . " " . $aInt->lang("fields", "mb") . ", ";
    if ($bwusage == $aInt->lang("global", "unlimited") || $bwlimit == $aInt->lang("global", "unlimited")) {
    } else {
        echo "<strong>" . round($bwusage / $bwlimit * 100, 0) . "% " . $aInt->lang("services", "used") . "</strong><br>";
    }
    echo "<small>(" . $aInt->lang("services", "lastupdated") . ": " . fromMySQLDate($lastupdate, "time") . ")</small>\n</div>\n<br />\n";
}
echo $frm->form("?userid=" . $userid . "&id=" . $id . ($aid ? "&aid=" . $aid : ""));
if ($aid) {
    if ($aid == "add") {
        checkPermission("Add New Order");
        $managetitle = $aInt->lang("addons", "addnew");
        $setupfee = "0.00";
        $recurring = "0.00";
        $regdate = $nextduedate = getTodaysDate();
        $notes = "";
    } else {
        $managetitle = $aInt->lang("addons", "editaddon");
        $result = select_query("tblhostingaddons", "", array("id" => $aid));
        $data = mysql_fetch_array($result);
        $addonid = $data['addonid'];
        $customname = $data['name'];
        $recurring = $data['recurring'];
        $setupfee = $data['setupfee'];
        $billingcycle = $data['billingcycle'];
        $status = $data['status'];
        $regdate = $data['regdate'];
        $nextduedate = $data['nextduedate'];
        $paymentmethod = $data['paymentmethod'];
        $tax = $data['tax'];
Esempio n. 6
0
        $amountout = formatCurrency($amountout);
        if ($invoiceid != "0") {
            $description .= " (<a href=\"invoices.php?action=edit&id=" . $invoiceid . "\">#" . $invoiceid . "</a>)";
        }
        if ($transid != "") {
            $description .= " - Trans ID: " . $transid;
        }
        $result2 = select_query("tblpaymentgateways", "", array("gateway" => $gateway, "setting" => "name"));
        $data = mysql_fetch_array($result2);
        $gateway = $data['value'];
        $tabledata[] = array($date, $gateway, $description, $amountin, $fees, $amountout, "<a href=\"" . $PHP_SELF . "?userid=" . $userid . "&action=edit&id=" . $ide . "\"><img src=\"images/edit.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Edit\"></a>", "<a href=\"#\" onClick=\"doDelete('" . $ide . "');return false\"><img src=\"images/delete.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Delete\"></a>");
    }
    echo $aInt->sortableTable(array(array("date", $aInt->lang("fields", "date")), array("gateway", $aInt->lang("fields", "paymentmethod")), array("description", $aInt->lang("fields", "description")), array("amountin", $aInt->lang("transactions", "amountin")), array("fees", $aInt->lang("transactions", "fees")), array("amountout", $aInt->lang("transactions", "amountout")), "", ""), $tabledata);
} else {
    if ($action == "add") {
        $date2 = getTodaysDate();
        echo "\n<p><b>";
        echo $aInt->lang("transactions", "addnew");
        echo "</b></p>\n\n<form method=\"post\" action=\"";
        echo $PHP_SELF;
        echo "?userid=";
        echo $userid;
        echo "&sub=add\" name=\"calendarfrm\">\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"15%\" class=\"fieldlabel\">";
        echo $aInt->lang("fields", "date");
        echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"date\" value=\"";
        echo $date2;
        echo "\" class=\"datepick\"></td><td class=\"fieldlabel\" width=\"15%\">";
        echo $aInt->lang("transactions", "amountin");
        echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"amountin\" size=10 value=\"0.00\"></td></tr>\n<tr><td class=\"fieldlabel\">";
        echo $aInt->lang("fields", "description");
        echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"description\" size=50></td><td class=\"fieldlabel\">";
Esempio n. 7
0
     $date = fromMySQLDate($date);
     $amount = formatCurrency($amount);
     if (!$description) {
         $description = "&nbsp;";
     }
     $tabledata[] = array($date, $affaccid, $aInt->outputClientLink($userid, $firstname, $lastname, $companyname), "<a href=\"clientshosting.php?userid=" . $userid . "&id=" . $relid . "\">" . $product . "</a>", $status, $description, $amount, "<a href=\"#\" onClick=\"doAffHistoryDelete('" . $historyid . "');return false\"><img src=\"images/delete.gif\" border=\"0\"></a>");
 }
 echo $aInt->sortableTable(array($aInt->lang("fields", "date"), $aInt->lang("affiliates", "refid"), $aInt->lang("fields", "clientname"), $aInt->lang("fields", "product"), $aInt->lang("affiliates", "productstatus"), "Description", $aInt->lang("fields", "amount"), ""), $tabledata);
 echo "\n<br />\n\n<form method=\"post\" action=\"";
 echo $PHP_SELF;
 echo "?action=addcomm&id=";
 echo $id;
 echo "\">\n<p align=\"left\"><b>Add Manual Commission Entry</b></p>\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td class=\"fieldlabel\">";
 echo $aInt->lang("fields", "date");
 echo ":</td><td class=\"fieldarea\"><input type=\"text\" name=\"date\" value=\"";
 echo getTodaysDate();
 echo "\" class=\"datepick\" /></td></tr>\n<tr><td class=\"fieldlabel\">Related Referral:</td><td class=\"fieldarea\">";
 echo "<s";
 echo "elect name=\"refid\"><option value=\"\">None</option>";
 $result = select_query("tblaffiliatesaccounts", "tblaffiliatesaccounts.*,(SELECT CONCAT(tblclients.firstname,'|||',tblclients.lastname,'|||',tblhosting.userid,'|||',tblproducts.name,'|||',tblhosting.domainstatus,'|||',tblhosting.domain,'|||',tblhosting.amount,'|||',tblhosting.regdate,'|||',tblhosting.billingcycle) FROM tblhosting INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid INNER JOIN tblclients ON tblclients.id=tblhosting.userid WHERE tblhosting.id=tblaffiliatesaccounts.relid) AS referraldata", array("affiliateid" => $id));
 while ($data = mysql_fetch_array($result)) {
     $affaccid = $data['id'];
     $lastpaid = $data['lastpaid'];
     $relid = $data['relid'];
     $referraldata = $data['referraldata'];
     $referraldata = explode("|||", $referraldata);
     $firstname = $referraldata[0];
     $lastname = $referraldata[1];
     $userid = $referraldata[2];
     $product = $referraldata[3];
     $status = $referraldata[4];
Esempio n. 8
0
function SumUpConfigOptionsOrder($id, $configoptions, $promocode, $paymentmethod = "", $checkout = "")
{
    global $CONFIG;
    global $_LANG;
    global $upgradeslist;
    global $orderamount;
    global $orderdescription;
    global $applytax;
    $_SESSION['upgradeids'] = array();
    $result = select_query("tblhosting", "packageid,domain,nextduedate,billingcycle", array("userid" => $_SESSION['uid'], "id" => $id));
    $data = mysql_fetch_array($result);
    $packageid = $data['packageid'];
    $domain = $data['domain'];
    $nextduedate = $data['nextduedate'];
    $billingcycle = $data['billingcycle'];
    $result = select_query("tblproducts", "name,tax", array("id" => $packageid));
    $data = mysql_fetch_array($result);
    $productname = $data['name'];
    $applytax = $data['tax'];
    if ($domain) {
        $productname .= " - " . $domain;
    }
    $year = substr($nextduedate, 0, 4);
    $month = substr($nextduedate, 5, 2);
    $day = substr($nextduedate, 8, 2);
    $cyclemonths = getBillingCycleMonths($billingcycle);
    $prevduedate = date("Y-m-d", mktime(0, 0, 0, $month - $cyclemonths, $day, $year));
    $totaldays = round((strtotime($nextduedate) - strtotime($prevduedate)) / 86400);
    $todaysdate = date("Ymd");
    $todaysdate = strtotime($todaysdate);
    $nextduedatetime = strtotime($nextduedate);
    $days = round(($nextduedatetime - $todaysdate) / 86400);
    if ($days < 0) {
        $days = $totaldays;
    }
    $percentage = $days / $totaldays;
    $discount = 0;
    $promoqualifies = true;
    if ($promocode) {
        $promodata = validateUpgradePromo($promocode);
        if (is_array($promodata)) {
            $appliesto = $promodata['appliesto'];
            $cycles = $promodata['cycles'];
            $promotype = $promodata['type'];
            $promovalue = $promodata['value'];
            $discounttype = $promodata['discounttype'];
            $upgradeconfigoptions = $promodata['configoptions'];
            $promodesc = $promodata['desc'];
            if ($promotype != "configoptions") {
                $promoqualifies = false;
            }
            if (count($appliesto) && $appliesto[0] && !in_array($packageid, $appliesto)) {
                $promoqualifies = false;
            }
            if (count($cycles) && $cycles[0] && !in_array($billingcycle, $cycles)) {
                $promoqualifies = false;
            }
            if ($discounttype == "Percentage") {
                $promovalue = $promovalue / 100;
            }
        }
        if ($promovalue == 0) {
            $promodata = get_query_vals("tblpromotions", "upgrades, upgradeconfig, type,value", array("lifetimepromo" => 1, "recurring" => 1, "code" => $promocode));
            if (is_array($promodata)) {
                if ($promodata['upgrades'] == 1) {
                    $upgradeconfig = unserialize($promodata['upgradeconfig']);
                    if ($upgradeconfig['type'] != "configoptions") {
                        $promoqualifies = false;
                    }
                    $promovalue = $upgradeconfig['value'];
                    $discounttype = $upgradeconfig['discounttype'];
                    if ($discounttype == "Percentage") {
                        $promovalue = $promovalue / 100;
                    }
                    $promoqualifies = true;
                } else {
                    $promoqualifies = false;
                }
            }
        }
    }
    $configoptions = getCartConfigOptions($packageid, $configoptions, $billingcycle);
    $oldconfigoptions = getCartConfigOptions($packageid, "", $billingcycle, $id);
    $subtotal = 0;
    foreach ($configoptions as $key => $configoption) {
        $configid = $configoption['id'];
        $configname = $configoption['optionname'];
        $optiontype = $configoption['optiontype'];
        $new_selectedvalue = $configoption['selectedvalue'];
        $new_selectedqty = $configoption['selectedqty'];
        $new_selectedname = $configoption['selectedname'];
        $new_selectedsetup = $configoption['selectedsetup'];
        $new_selectedrecurring = $configoption['selectedrecurring'];
        $old_selectedvalue = $oldconfigoptions[$key]['selectedvalue'];
        $old_selectedqty = $oldconfigoptions[$key]['selectedqty'];
        $old_selectedname = $oldconfigoptions[$key]['selectedname'];
        $old_selectedsetup = $oldconfigoptions[$key]['selectedsetup'];
        $old_selectedrecurring = $oldconfigoptions[$key]['selectedrecurring'];
        if (($optiontype == 1 || $optiontype == 2) && $new_selectedvalue != $old_selectedvalue || ($optiontype == 3 || $optiontype == 4) && $new_selectedqty != $old_selectedqty) {
            $difference = $new_selectedrecurring - $old_selectedrecurring;
            $amountdue = $difference * $percentage;
            $amountdue = format_as_currency($amountdue);
            if (!$CONFIG['CreditOnDowngrade'] && $amountdue < 0) {
                $amountdue = format_as_currency(0);
            }
            if ($optiontype == 1 || $optiontype == 2) {
                $db_orig_value = $old_selectedvalue;
                $db_new_value = $new_selectedvalue;
                $originalvalue = $old_selectedname;
                $newvalue = $new_selectedname;
            } else {
                if ($optiontype == 3) {
                    $db_orig_value = $old_selectedqty;
                    $db_new_value = $new_selectedqty;
                    if ($old_selectedqty) {
                        $originalvalue = $_LANG['yes'];
                        $newvalue = $_LANG['no'];
                    } else {
                        $originalvalue = $_LANG['no'];
                        $newvalue = $_LANG['yes'];
                    }
                } else {
                    if ($optiontype == 4) {
                        $new_selectedqty = (int) $new_selectedqty;
                        if ($new_selectedqty < 0) {
                            $new_selectedqty = 0;
                        }
                        $db_orig_value = $old_selectedqty;
                        $db_new_value = $new_selectedqty;
                        $originalvalue = $old_selectedqty;
                        $newvalue = $new_selectedqty . " x " . $configoption['options'][0]['nameonly'];
                    }
                }
            }
            $subtotal += $amountdue;
            $itemdiscount = 0;
            if ($promoqualifies && 0 < $amountdue && (!count($upgradeconfigoptions) || in_array($configid, $upgradeconfigoptions))) {
                $itemdiscount = $discounttype == "Percentage" ? round($amountdue * $promovalue, 2) : ($amountdue < $promovalue ? $amountdue : $promovalue);
            }
            $discount += $itemdiscount;
            $upgradearray[] = array("configname" => $configname, "originalvalue" => $originalvalue, "newvalue" => $newvalue, "price" => formatCurrency($amountdue));
            if ($checkout) {
                if ($orderdescription) {
                    $orderdescription .= "<br>\r\n<br>\r\n";
                }
                $orderdescription .= $_LANG['upgradedowngradeconfigoptions'] . (": " . $configname . " - " . $originalvalue . " => " . $newvalue . "<br>\r\nAmount Due: ") . formatCurrency($amountdue);
                $paid = "N";
                if ($amountdue <= 0) {
                    $paid = "Y";
                }
                $amountwithdiscount = $amountdue - $itemdiscount;
                $upgradeid = insert_query("tblupgrades", array("type" => "configoptions", "date" => "now()", "relid" => $id, "originalvalue" => "" . $configid . "=>" . $db_orig_value, "newvalue" => $db_new_value, "amount" => $amountwithdiscount, "recurringchange" => $difference, "status" => "Pending", "paid" => $paid));
                $_SESSION['upgradeids'][] = $upgradeid;
                if (0 < $amountdue) {
                    insert_query("tblinvoiceitems", array("userid" => $_SESSION['uid'], "type" => "Upgrade", "relid" => $upgradeid, "description" => $_LANG['upgradedowngradeconfigoptions'] . (": " . $productname . "\r\n" . $configname . ": " . $originalvalue . " => " . $newvalue . " (") . getTodaysDate() . " - " . fromMySQLDate($nextduedate) . ")", "amount" => $amountdue, "taxed" => $applytax, "duedate" => "now()", "paymentmethod" => $paymentmethod));
                    if (0 < $itemdiscount) {
                        insert_query("tblinvoiceitems", array("userid" => $_SESSION['uid'], "description" => $_LANG['orderpromotioncode'] . ": " . $promocode . " - " . $promodesc, "amount" => $itemdiscount * (0 - 1), "taxed" => $applytax, "duedate" => "now()", "paymentmethod" => $paymentmethod));
                    }
                    $orderamount += $amountwithdiscount;
                    continue;
                }
                if ($CONFIG['CreditOnDowngrade']) {
                    $creditamount = $amountdue * (0 - 1);
                    insert_query("tblcredit", array("clientid" => $_SESSION['uid'], "date" => "now()", "description" => "Upgrade/Downgrade Credit", "amount" => $creditamount));
                    update_query("tblclients", array("credit" => "+=" . $creditamount), array("id" => (int) $_SESSION['uid']));
                }
                doUpgrade($upgradeid);
                continue;
            }
            continue;
        }
    }
    if (!count($upgradearray)) {
        redir("type=configoptions&id=" . (int) $id, "upgrade.php");
    }
    $GLOBALS['subtotal'] = $subtotal;
    $GLOBALS['qualifies'] = $promoqualifies;
    $GLOBALS['discount'] = $discount;
    return $upgradearray;
}
Esempio n. 9
0
function project_management_output($vars)
{
    global $whmcs;
    global $licensing;
    global $CONFIG;
    global $aInt;
    global $numrows;
    global $page;
    global $limit;
    global $order;
    global $orderby;
    global $jquerycode;
    global $jscode;
    global $attachments_dir;
    require ROOTDIR . "/includes/clientfunctions.php";
    require ROOTDIR . "/includes/invoicefunctions.php";
    $modulelink = $vars['modulelink'];
    $perms = unserialize($vars['perms']);
    $m = $_REQUEST['m'];
    $a = $_REQUEST['a'];
    $action = $_REQUEST['action'];
    if (!PMADDONLICENSE) {
        if ($whmcs->get_req_var("refresh")) {
            $licensing->forceRemoteCheck();
            redir("module=project_management");
        }
        echo "<div class=\"gracefulexit\">\nYour WHMCS license key is not enabled to use the Project Management Addon yet.<br /><br />\nYou can find out more about it and purchase @ <a href=\"http://go.whmcs.com/90/project-management\" target=\"_blank\">www.whmcs.com/addons/project-management</a><br /><br />\nIf you have only recently purchased the addon, please <a href=\"addonmodules.php?module=project_management&refresh=1\">click here</a> to perform a license refresh.\n</div>";
        return false;
    }
    if ($_REQUEST['createproj']) {
        $statuses = explode(",", $vars['statusvalues']);
        if ($_REQUEST['ajax']) {
            if (project_management_checkperm("Create New Projects")) {
                $dates = array();
                foreach ($_REQUEST['input'] as $key => $value) {
                    if ($value['name'] == "ticketnum") {
                        $value['name'] = "ticketids";
                    }
                    if ($value['name'] == "created" || $value['name'] == "duedate") {
                        $dates[$value['name']] = $value['value'];
                        $value['value'] = toMySQLDate($value['value']);
                    }
                    $insertarr[$value['name']] = $value['value'];
                }
                $insertarr['status'] = $statuses[0];
                $insertarr['lastmodified'] = "now()";
                $projectid = insert_query("mod_project", $insertarr);
                echo "<tr><td><a href=\"addonmodules.php?module=project_management&m=view&projectid=" . $projectid . "\">" . $projectid . "</a></td><td><a href=\"addonmodules.php?module=project_management&m=view&projectid=" . $projectid . "\">" . $insertarr['title'] . "</a> <span id=\"projecttimercontrol" . $projectid . "\" class=\"tickettimer\"><a href=\"#\" onclick=\"projectstarttimer('" . $projectid . "');return false\"><img src=\"../modules/addons/project_management/images/starttimer.png\" align=\"absmiddle\" border=\"0\" /> Start Tracking Time</a></td><td>" . get_query_val("tbladmins", "CONCAT(firstname,' ',lastname)", array("id" => $insertarr['adminid'])) . "</td><td>" . $dates['created'] . "</td><td>" . $dates['duedate'] . "</td><td>" . getTodaysDate() . "</td><td>" . $statuses[0] . "</td></tr>";
                exit;
            } else {
                echo "0";
                exit;
            }
        }
        if (project_management_checkperm("Create New Projects") && trim($_REQUEST['title'])) {
            $projectid = insert_query("mod_project", array("title" => $_REQUEST['title'], "userid" => $_REQUEST['userid'], "created" => toMySQLDate($_REQUEST['created']), "duedate" => toMySQLDate($_REQUEST['duedate']), "adminid" => $_REQUEST['adminid'], "ticketids" => $_REQUEST['ticketnum'], "status" => $statuses[0]));
            project_management_log($projectid, $vars['_lang']['createdproject']);
            redir("module=project_management&m=view&projectid=" . (int) $projectid);
        }
    }
    $jscode = "function createnewproject() {\n    \$(\"#createnewcont\").slideDown();\n}\nfunction cancelnewproject() {\n    \$(\"#createnewcont\").slideUp();\n}\nfunction searchselectclient(userid,name,email) {\n    \$(\"#clientname\").val(name);\n    \$(\"#userid\").val(userid);\n    \$(\"#cpclientname\").val(name);\n    \$(\"#cpuserid\").val(userid);\n    \$(\"#cpclientsearchcancel\").fadeOut();\n\t\$(\"#cpticketclientsearchresults\").slideUp(\"slow\");\n}\n";
    $jquerycode = "\$(\"#cpclientname\").keyup(function () {\n\tvar ticketuseridsearchlength = \$(\"#cpclientname\").val().length;\n\tif (ticketuseridsearchlength>2) {\n\t\$.post(\"search.php\", { ticketclientsearch: 1, value: \$(\"#cpclientname\").val() },\n\t    function(data){\n            if (data) {\n                \$(\"#cpticketclientsearchresults\").html(data);\n                \$(\"#cpticketclientsearchresults\").slideDown(\"slow\");\n                \$(\"#cpclientsearchcancel\").fadeIn();\n            }\n        });\n\t}\n});\n\$(\"#cpclientsearchcancel\").click(function () {\n    \$(\"#cpticketclientsearchresults\").slideUp(\"slow\");\n    \$(\"#cpclientsearchcancel\").fadeOut();\n});";
    $headeroutput = "\n<link href=\"../modules/addons/project_management/css/style.css\" rel=\"stylesheet\" type=\"text/css\" />\n\n<div class=\"projectmanagement\">";
    if (project_management_checkperm("Create New Projects")) {
        $headeroutput .= "\n<div id=\"createnewcont\" style=\"display:none;\">\n<div class=\"createnewcont2\">\n<div class=\"createnewproject\">\n<div class=\"title\">" . $vars['_lang']['createnewproject'] . "</div>\n<form method=\"post\" action=\"" . $modulelink . "&createproj=1\">\n<div class=\"label\">" . $vars['_lang']['title'] . "</div>\n<input type=\"text\" name=\"title\" class=\"title\" />\n<div class=\"float\">\n<div class=\"label\">" . $vars['_lang']['created'] . "</div>\n<input type=\"text\" name=\"created\" class=\"datepick\" value=\"" . getTodaysDate() . "\" />\n</div>\n<div class=\"float\">\n<div class=\"label\">" . $vars['_lang']['duedate'] . "</div>\n<input type=\"text\" name=\"duedate\" class=\"datepick\" value=\"" . getTodaysDate() . "\" />\n</div>\n<div class=\"float\">\n<div class=\"label\">" . $vars['_lang']['assignedto'] . "</div>\n<select class=\"title\" name=\"adminid\">";
        $headeroutput .= "<option value=\"0\">" . $vars['_lang']['none'] . "</option>";
        $result = select_query("tbladmins", "id,firstname,lastname", array("disabled" => "0"), "firstname` ASC,`lastname", "ASC");
        while ($data = mysql_fetch_array($result)) {
            $aid = $data['id'];
            $adminfirstname = $data['firstname'];
            $adminlastname = $data['lastname'];
            $headeroutput .= "<option value=\"" . $aid . "\"";
            if ($aid == $adminid) {
                echo " selected";
            }
            $headeroutput .= ">" . $adminfirstname . " " . $adminlastname . "</option>";
        }
        $headeroutput .= "</select>\n</div>\n<div class=\"float\">\n<div class=\"label\">" . $vars['_lang']['ticketnumberhash'] . "</div>\n<input type=\"text\" name=\"ticketnum\" class=\"ticketnum\" />\n</div>\n<div class=\"clear\"></div>\n<div class=\"float\">\n<div class=\"label\">" . $vars['_lang']['associatedclient'] . "</div>\n<input type=\"hidden\" name=\"userid\" id=\"cpuserid\" /><input type=\"text\" id=\"cpclientname\" value=\"" . $clientname . "\" class=\"title\" onfocus=\"if(this.value=='" . addslashes($clientname) . "')this.value=''\" /> <img src=\"images/icons/delete.png\" alt=\"" . $vars['_lang']['cancel'] . "\" align=\"right\" id=\"clientsearchcancel\" height=\"16\" width=\"16\"><div id=\"cpticketclientsearchresults\" style=\"z-index:2000;\"></div>\n</div>\n<br /><br />\n<div align=\"center\"><input type=\"submit\" value=\"" . $vars['_lang']['create'] . "\" class=\"create\" />&nbsp;<input type=\"button\" value=\"" . $vars['_lang']['cancel'] . "\" class=\"create\" onclick=\"cancelnewproject();return false\" /></div>\n</form>\n</div>\n</div>\n</div>";
    }
    $headeroutput .= "<div class=\"adminbar\"><a href=\"" . $modulelink . "\"><img src=\"images/icons/system.png\" /> " . $vars['_lang']['home'] . "</a> <a href=\"" . $modulelink . "&m=reports\"><img src=\"images/icons/reports.png\" /> " . $vars['_lang']['viewreports'] . "</a> <a href=\"reports.php?report=project_staff_logs\"><img src=\"images/icons/billableitems.png\" /> " . $vars['_lang']['viewstafflogs'] . "</a> <a href=\"" . $modulelink . "&m=activity\"><img src=\"images/icons/logs.png\" /> " . $vars['_lang']['viewactivitylogs'] . "</a> ";
    if (project_management_check_masteradmin()) {
        $headeroutput .= "<a href=\"" . $modulelink . "&m=settings\"><img src=\"images/icons/config.png\" /> " . $vars['_lang']['settings'] . "</a> ";
    }
    $headeroutput .= "<a href=\"http://docs.whmcs.com/Project_Management\"><img src=\"images/icons/support.png\" /> " . $vars['_lang']['help'] . "</a></div>\n\n<div class=\"mainbar\">\n<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>";
    if (project_management_checkperm("Create New Projects")) {
        $headeroutput .= "<a href=\"#\" onclick=\"createnewproject();return false\" class=\"create\"><img src=\"images/icons/add.png\" align=\"top\" border=\"0\" /> <b>" . $vars['_lang']['createnewproject'] . "</b></a>\n</td><td align=\"center\">";
    }
    $headeroutput .= "<span class=\"browsehover\">" . $vars['_lang']['browseprojects'] . "</span>:&nbsp;<a href=\"" . $modulelink . "\">" . $vars['_lang']['incomplete'] . "</a> | <a href=\"" . $modulelink . "&view=mineincomplete\">" . $vars['_lang']['myincomplete'] . "</a> | <a href=\"" . $modulelink . "&view=all\">" . $vars['_lang']['viewall'] . "</a> | <a href=\"" . $modulelink . "&view=mine\">" . $vars['_lang']['assignedtome'] . "</a> | <a href=\"" . $modulelink . "&view=week\">" . $vars['_lang']['duein7days'] . "</a> | <a href=\"" . $modulelink . "&view=closed\">" . $vars['_lang']['closed'] . "</a><br />\n<strong>" . $vars['_lang']['browsetasks'] . "</strong>&nbsp;:&nbsp;<a href=\"" . $modulelink . "&view=tasks&filter=incomplete\">" . $vars['_lang']['incomplete'] . "</a> | <a href=\"" . $modulelink . "&view=tasks&filter=mineincomplete\">" . $vars['_lang']['myincomplete'] . "</a> | <a href=\"" . $modulelink . "&view=tasks\">" . $vars['_lang']['viewall'] . "</a> | <a href=\"" . $modulelink . "&view=tasks&filter=mine\">" . $vars['_lang']['assignedtome'] . "</a> | <a href=\"" . $modulelink . "&view=tasks&filter=week\">" . $vars['_lang']['duein7days'] . "</a> | <a href=\"" . $modulelink . "&view=tasks&filter=closed\">" . $vars['_lang']['closed'] . "</a></span>\n</td><td>\n<form method=\"post\" action=\"" . $modulelink . "\">\n<div class=\"search\"><input type=\"text\" name=\"q\" value=\"" . (isset($_REQUEST['q']) ? $_REQUEST['q'] : $vars['_lang']['search']) . "\" onfocus=\"this.value=(this.value=='" . $vars['_lang']['search'] . "') ? '' : this.value;\" onblur=\"this.value=(this.value=='') ? '" . $vars['_lang']['search'] . "' : this.value;\" class=\"search\" /></div>\n</form>\n</td></tr></table>\n</div>\n";
    if (!in_array($m, array("view", "edittask", "activity", "reports", "settings"))) {
        $m = "overview";
    }
    $modulelink .= "&m=" . $m;
    require ROOTDIR . "/modules/addons/project_management/" . $m . ".php";
    echo "</div>";
}
Esempio n. 10
0
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
define("ADMINAREA", true);
require "../init.php";
$aInt = new WHMCS_Admin("View Gateway Log");
$aInt->title = $aInt->lang("gatewaytranslog", "gatewaytranslogtitle");
$aInt->sidebar = "billing";
$aInt->icon = "logs";
ob_start();
echo $aInt->Tabs(array($aInt->lang("global", "searchfilter")), true);
if (!count($_REQUEST)) {
    $startdate = fromMySQLDate(date("Y-m-d", mktime(0, 0, 0, date("m") - 3, date("d"), date("Y"))));
    $enddate = getTodaysDate();
}
echo "\n<div id=\"tab0box\" class=\"tabbox\">\n  <div id=\"tab_content\">\n\n<form method=\"post\" action=\"gatewaylog.php\">\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td width=\"15%\" class=\"fieldlabel\">";
echo $aInt->lang("fields", "daterange");
echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"startdate\" value=\"";
echo $startdate;
echo "\" class=\"datepick\" /> &nbsp; ";
echo $aInt->lang("global", "to");
echo " <input type=\"text\" name=\"enddate\" value=\"";
echo $enddate;
echo "\" class=\"datepick\" /></td><td width=\"15%\" class=\"fieldlabel\">";
echo $aInt->lang("gatewaytranslog", "gateway");
echo "</td><td class=\"fieldarea\">";
echo "<s";
echo "elect name=\"filtergateway\"><option value=\"\">";
echo $aInt->lang("global", "any");
Esempio n. 11
0
     $bwunits = "GB";
     $bwusage = $bwusage / 1024;
 } else {
     if ($overagesenabled[2] == "TB") {
         $bwunits = "TB";
         $bwusage = $bwusage / (1024 * 1024);
     }
 }
 $diskoverage = $diskusage - $thisoveragesdisklimit;
 $bwoverage = $bwusage - $thisoveragesbwlimit;
 $overagedesc = $prodname;
 if ($domain) {
     $overagedesc .= " - " . $domain;
 }
 $overagesfrom = fromMySQLDate(date("Y-m-d", mktime(0, 0, 0, date("m"), 1, date("Y"))));
 $overagesto = getTodaysDate();
 $overagedesc .= " (" . $overagesfrom . " - " . $overagesto . ")";
 getUsersLang($userid);
 if ($thisoveragesdisklimit && 0 < $diskoverage) {
     if ($diskoverage < 0) {
         $diskoverage = 0;
     }
     $diskoverage = round($diskoverage, 2);
     $diskoveragedesc = $overagedesc . "\r\n" . $_LANG['overagestotaldiskusage'] . (" = " . $diskusage . " ") . $diskunits . " - " . $_LANG['overagescharges'] . (" = " . $diskoverage . " ") . $diskunits . (" @ " . $overagesdiskprice . "/") . $diskunits;
     $diskoverageamount = $diskoverage * $overagesdiskprice;
     insert_query("tblbillableitems", array("userid" => $userid, "description" => $diskoveragedesc, "amount" => $diskoverageamount, "recur" => 0, "recurcycle" => 0, "recurfor" => 0, "invoiceaction" => $invoiceaction, "duedate" => date("Y-m-d")));
 }
 if ($thisoveragesbwlimit && 0 < $bwoverage) {
     if ($bwoverage < 0) {
         $bwoverage = 0;
     }
Esempio n. 12
0
     $maxuses = $data['maxuses'];
     $itemdata = $data['itemdata'];
     $allowpromo = $data['allowpromo'];
     $showgroup = $data['showgroup'];
     $gid = $data['gid'];
     $description = $data['description'];
     $displayprice = $data['displayprice'];
     $sortorder = $data['sortorder'];
     $itemdata = unserialize($itemdata);
     $validfrom = fromMySQLDate($validfrom);
     $validuntil = fromMySQLDate($validuntil);
     $validuntilblank = fromMySQLDate("0000-00-00");
 } else {
     $managetitle = $aInt->lang("bundles", "createnewbundle");
     $itemdata = array();
     $validfrom = getTodaysDate();
     $validuntil = fromMySQLDate(date("Y-m-d", mktime(0, 0, 0, date("m") + 1, date("d"), date("Y"))));
     $uses = $maxuses = $sortorder = "0";
     $displayprice = "0.00";
     $showgroup = "";
 }
 echo "<p><b>" . $managetitle . "</b></p>";
 $url = $CONFIG['SystemSSLURL'] ? $CONFIG['SystemSSLURL'] : $CONFIG['SystemURL'];
 $currency = getCurrency();
 echo "\r\n";
 echo "<s";
 echo "tyle>\n.bundleitem {\n    margin: 5px;\n    padding: 10px;\n    width: 75%;\n    background-color: #fff;\n    -moz-border-radius: 5px;\n    -webkit-border-radius: 5px;\n    -o-border-radius: 5px;\n    border-radius: 5px;\n}\n.bundleadd {\n    margin: 5px 20px;\n}\n</style>\n\n<form method=\"post\" action=\"";
 echo $PHP_SELF;
 echo "?action=save&id=";
 echo $id;
 echo "\">\n\n<table class=\"form\" width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n<tr><td class=\"fieldlabel\" width=\"200\">";
Esempio n. 13
0
        echo "';\"";
        if (!$id) {
            echo " disabled=\"true\"";
        }
        echo " /> <input type=\"button\" value=\"Email as PDF\" class=\"button\" onclick=\"window.location='quotes.php?action=sendpdf&id=";
        echo $id . generate_token("link");
        echo "';\"";
        if (!$id) {
            echo " disabled=\"true\"";
        }
        echo " /> <input type=\"button\" value=\"Convert to Invoice\" onClick=\"showDialog('quoteconvert')\"";
        if (!$id) {
            echo " disabled=\"true\"";
        }
        echo " /> <input type=\"button\" value=\"Delete\" class=\"btn warn\" onclick=\"doDelete('";
        echo $id;
        echo "');\"";
        if (!$id) {
            echo " disabled=\"true\"";
        }
        echo " /></p>\n\n</form>\n\n";
        $content = "<form id=\"convertquotefrm\">\n" . generate_token("form") . "\n<label><input type=\"radio\" name=\"invoicetype\" value=\"single\" onclick=\"selectSingle()\" checked /> Generate a single invoice for the entire amount</label><br />\n<div id=\"singleoptions\" align=\"center\">\n<br />\nDue Date of Invoice: <input type=\"text\" name=\"invoiceduedate\" value=\"" . getTodaysDate() . "\" class=\"datepick\" />\n<br /><br />\n</div>\n<label><input type=\"radio\" name=\"invoicetype\" value=\"deposit\" onclick=\"selectDeposit()\" /> Split into 2 invoices - a deposit and final payment</label><br />\n<div id=\"depositoptions\" align=\"center\" style=\"display:none;\">\n<br />\nEnter Deposit Percentage: <input type=\"text\" name=\"depositpercent\" value=\"50\" size=\"5\" />%<br />\nDue Date of Deposit: <input type=\"text\" name=\"depositduedate\" value=\"" . getTodaysDate() . "\" class=\"datepick\" /><br />\nDue Date of Final Payment: <input type=\"text\" name=\"finalduedate\" value=\"" . fromMySQLDate(date("Y-m-d", mktime(0, 0, 0, date("m") + 1, date("d"), date("Y")))) . "\" class=\"datepick\" />\n</div>\n<br />\n<label><input type=\"checkbox\" name=\"sendemail\" checked /> Send Invoice Notification Email</label>\n</form>";
        echo $aInt->jqueryDialog("quoteconvert", "Convert to Invoice", $content, array("Submit" => "window.location='" . $PHP_SELF . "?action=convert&id=" . $id . "&'+\$('#convertquotefrm').serialize();"), "", "500", "");
    }
}
$content = ob_get_contents();
ob_end_clean();
$aInt->content = $content;
$aInt->jquerycode = $jquerycode;
$aInt->jscode = $jscode;
$aInt->display();
Esempio n. 14
0
 public function calcConfigOptionsUpgradeDue()
 {
     global $whmcs;
     $pid = $this->getProductInfo("pid");
     $domain = $this->getProductInfo("domain");
     $nextduedate = $this->getProductInfo("nextduedate");
     $billingcycle = $this->getProductInfo("billingcycle");
     $productname = $this->getProductInfo("productname");
     $applytax = $this->getProductInfo("tax");
     if ($domain) {
         $productname .= " - " . $domain;
     }
     $year = substr($nextduedate, 0, 4);
     $month = substr($nextduedate, 5, 2);
     $day = substr($nextduedate, 8, 2);
     $cyclemonths = getBillingCycleMonths($billingcycle);
     $prevduedate = date("Y-m-d", mktime(0, 0, 0, $month - $cyclemonths, $day, $year));
     $totaldays = round((strtotime($nextduedate) - strtotime($prevduedate)) / 86400);
     $todaysdate = date("Y-m-d");
     $todaysdate = strtotime($todaysdate);
     $nextduedatetime = strtotime($nextduedate);
     $days = round(($nextduedatetime - $todaysdate) / 86400);
     if ($days < 0) {
         $days = $totaldays;
     }
     $percentage = $days / $totaldays;
     $newconfigoptions = getCartConfigOptions($pid, $this->newconfigoptions, $billingcycle);
     $oldconfigoptions = getCartConfigOptions($pid, "", $billingcycle, $id);
     foreach ($newconfigoptions as $key => $configoption) {
         $configid = $configoption['id'];
         $configname = $configoption['optionname'];
         $optiontype = $configoption['optiontype'];
         $new_selectedvalue = $configoption['selectedvalue'];
         $new_selectedqty = $configoption['selectedqty'];
         $new_selectedname = $configoption['selectedname'];
         $new_selectedsetup = $configoption['selectedsetup'];
         $new_selectedrecurring = $configoption['selectedrecurring'];
         $old_selectedvalue = $oldconfigoptions[$key]['selectedvalue'];
         $old_selectedqty = $oldconfigoptions[$key]['selectedqty'];
         $old_selectedname = $oldconfigoptions[$key]['selectedname'];
         $old_selectedsetup = $oldconfigoptions[$key]['selectedsetup'];
         $old_selectedrecurring = $oldconfigoptions[$key]['selectedrecurring'];
         if (($optiontype == 1 || $optiontype == 2) && $new_selectedvalue != $old_selectedvalue || ($optiontype == 3 || $optiontype == 4) && $new_selectedqty != $old_selectedqty) {
             $difference = $new_selectedrecurring - $old_selectedrecurring;
             $amountdue = $difference * $percentage;
             $amountdue = format_as_currency($amountdue);
             if (!$CONFIG['CreditOnDowngrade'] && $amountdue < 0) {
                 $amountdue = format_as_currency(0);
             }
             if ($optiontype == 1 || $optiontype == 2) {
                 $db_orig_value = $old_selectedvalue;
                 $db_new_value = $new_selectedvalue;
                 $originalvalue = $old_selectedname;
                 $newvalue = $new_selectedname;
             } else {
                 if ($optiontype == 3) {
                     $db_orig_value = $old_selectedqty;
                     $db_new_value = $new_selectedqty;
                     if ($old_selectedqty) {
                         $originalvalue = $whmcs->get_lang("yes");
                         $newvalue = $whmcs->get_lang("no");
                     } else {
                         $originalvalue = $whmcs->get_lang("no");
                         $newvalue = $whmcs->get_lang("yes");
                     }
                 } else {
                     if ($optiontype == 4) {
                         $new_selectedqty = (int) $new_selectedqty;
                         if ($new_selectedqty < 0) {
                             $new_selectedqty = 11;
                         }
                         $db_orig_value = $old_selectedqty;
                         $db_new_value = $new_selectedqty;
                         $originalvalue = $old_selectedqty;
                         $newvalue = $new_selectedqty . " " . $configoption['options'][0]['nameonly'];
                     }
                 }
             }
             $itemdiscount = 0;
             if ($promoqualifies && 0 < $amountdue && (!count($upgradeconfigoptions) || in_array($configid, $upgradeconfigoptions))) {
                 $itemdiscount = $discounttype == "Percentage" ? round($amountdue * $promovalue, 2) : ($amountdue < $promovalue ? $amountdue : $promovalue);
             }
             $discount += $itemdiscount;
             $description = $productname . "\r\n" . $configname . ": " . (0 < $amountdue ? "Upgrade" : "Downgrade") . " from " . $originalvalue . " to " . $newvalue . " (" . getTodaysDate() . " - " . fromMySQLDate($nextduedate) . ")" . "\r\n" . "Regular Recurring Amount Increase: " . formatCurrency($difference) . "";
             $this->addLineItem($description, $amountdue);
             $upgradearray[] = array("configname" => $configname, "originalvalue" => $originalvalue, "newvalue" => $newvalue, "price" => formatCurrency($amountdue));
             continue;
         }
     }
     return $upgradearray;
 }