Jump to content

sentq

GearHead
  • Content count

    2,069
  • Joined

  • Last visited

  • Days Won

    23

sentq last won the day on November 18

sentq had the most liked content!

Community Reputation

338 Excellent

1 Follower

About sentq

  • Rank
    WHMCS GearHead
  1. Installation

    make sure you've uploaded all files "Manually" in the right path and have the correct permission/owner
  2. replace: $reportdata["tablevalues"][] = array("$id","$client","$date","$datepaid","$subtotal","$tax","$credit","$total", "$getCustomFieldValue['value']"); with: $reportdata["tablevalues"][] = array("$id","$client","$date","$datepaid","$subtotal","$tax","$credit","$total", "{$getCustomFieldValue['value']}"); tested with v7.4.1 but it should work with older versions the same.
  3. I've updated the code above to use the custom field name you mentioned "Your GSTIN No.", if you still get 500 error page then enable display errors features and try again error message will be displayed then. It was already tested before I publish it here yesterday, so let me know.
  4. I've edited the original report to query your custom field value, create new file inside /modules/reports/ directory (as any changes to the original file will be overwritten when WHMCS updated) and copy the following code inside, test <?php /** * WHMCS Sales Tax Liability Report * * Edited version to display "GSTIN" custom field value * * @author SENTQ (19/11/2017) * * */ if (!defined("WHMCS")) die("This file cannot be accessed directly"); $reportdata["title"] = "Sales Tax Liability"; $reportdata["description"] = "This report shows sales tax liability for the selected period"; $reportdata["currencyselections"] = true; $query = "select year(min(date)) as minimum, year(max(date)) as maximum from tblaccounts;"; $result = full_query($query); $data = mysql_fetch_array($result); $minyear = $data['minimum']; $maxyear = $data['maximum']; if (!$startdate) { $startdate = fromMySQLDate(date('Y-m-d')); } if (!$enddate) { $enddate = fromMySQLDate(date('Y-m-d')); } $queryStartDate = db_make_safe_human_date($startdate); $queryEndDate = db_make_safe_human_date($enddate); $currencyID = (int) $currencyid; $reportdata["headertext"] = "<form method=\"post\" action=\"?report=$report&currencyid=$currencyid&calculate=true\"><center>Start Date: <input type=\"text\" name=\"startdate\" value=\"$startdate\" class=\"datepick\" /> End Date: <input type=\"text\" name=\"enddate\" value=\"$enddate\" class=\"datepick\" /> <input type=\"submit\" value=\"Generate Report\"></form>"; if ($calculate) { $query = <<<QUERY SELECT COUNT(*), SUM(total), SUM(tblinvoices.credit), SUM(tax), SUM(tax2) FROM tblinvoices INNER JOIN tblclients ON tblclients.id = tblinvoices.userid WHERE datepaid >= '{$queryStartDate}' AND datepaid <= '{$queryEndDate} 23:59:59' AND tblinvoices.status = 'Paid' AND currency = {$currencyID} AND (SELECT count(tblinvoiceitems.id) FROM tblinvoiceitems WHERE invoiceid = tblinvoices.id AND (type = 'AddFunds' OR type = 'Invoice') ) = 0; QUERY; $result = full_query($query); $data = mysql_fetch_array($result); $numinvoices = $data[0]; $total = $data[1] + $data[2]; $tax = $data[3]; $tax2 = $data[4]; if (!$total) $total="0.00"; if (!$tax) $tax="0.00"; if (!$tax2) $tax2="0.00"; $reportdata["headertext"] .= "<br>$numinvoices Invoices Found<br><B>Total Invoiced:</B> ".formatCurrency($total)." <B>Tax Level 1 Liability:</B> ".formatCurrency($tax)." <B>Tax Level 2 Liability:</B> ".formatCurrency($tax2); } $reportdata["headertext"] .= "</center>"; $reportdata["tableheadings"] = array( $aInt->lang('fields', 'invoiceid'), $aInt->lang('fields', 'clientname'), $aInt->lang('fields', 'invoicedate'), $aInt->lang('fields', 'datepaid'), $aInt->lang('fields', 'subtotal'), $aInt->lang('fields', 'tax'), $aInt->lang('fields', 'credit'), $aInt->lang('fields', 'total'), "GSTIN" ); $query = <<<QUERY SELECT tblinvoices.*, tblclients.firstname, tblclients.lastname FROM tblinvoices INNER JOIN tblclients ON tblclients.id = tblinvoices.userid WHERE datepaid >= '{$queryStartDate}' AND datepaid <= '{$queryEndDate} 23:59:59' AND tblinvoices.status = 'Paid' AND currency = {$currencyID} AND (SELECT count(tblinvoiceitems.id) FROM tblinvoiceitems WHERE invoiceid = tblinvoices.id AND (type = 'AddFunds' OR type = 'Invoice') ) = 0 ORDER BY date ASC; QUERY; $result = full_query($query); while ($data = mysql_fetch_array($result)) { $id = $data["id"]; $userid = $data["userid"]; $client = $data["firstname"]." ".$data["lastname"]; $date = fromMySQLDate($data["date"]); $datepaid = fromMySQLDate($data["datepaid"]); $currency = getCurrency($userid); $subtotal = $data["subtotal"]; $credit = $data["credit"]; $tax = $data["tax"]+$data["tax2"]; $total = $data["total"] + $credit; # Get Custom Field Value $getCustomFieldValue = full_query("SELECT `value` FROM `tblcustomfieldsvalues` INNER JOIN `tblcustomfields` ON (`tblcustomfieldsvalues`.`fieldid` = `tblcustomfields`.`id`) WHERE `tblcustomfields`.`type` = 'client' AND `fieldname` = 'Your GSTIN No.' AND `tblcustomfieldsvalues`.`relid` = '".$data["userid"]."' LIMIT 1"); $getCustomFieldValue = mysql_fetch_assoc($getCustomFieldValue); $reportdata["tablevalues"][] = array("$id","$client","$date","$datepaid","$subtotal","$tax","$credit","$total", "$getCustomFieldValue['value']"); } $data["footertext"]="This report excludes invoices that affect a clients credit balance " . "since this income will be counted and reported when it is applied to invoices for products/services.";
  5. WHMCS - Facebook pixel script

    I mean that we need to know how you did it in the WHMCS side to help you fix it if possible
  6. WHMCS - Facebook pixel script

    how did you make it, probably something are missing or added in the wrong place?
  7. 1) Delete all files from inside /templates_c/ directory, or from Admin Area -> Utilities -> System -> System Clean up -> Empty Template Cache. 2) if #1 didn't solve the problem, then try this: https://docs.whmcs.com/Blank_or_Partially_Rendered_Pages#Enabling_From_Your_Configuration_File
  8. How to delete menu item?

    Welcome to the WHMCS community you need to create new .php file inside /includes/hooks/ directory, the file name could be anything, lets call it RemoveNavbarAnnouncementsStatus.php then copy the following lines inside it, it should remove both links from Primary Navbar: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->removeChild('Announcements'); } if (!is_null($primaryNavbar->getChild('Network Status'))) { $primaryNavbar->removeChild('Network Status'); } });
  9. We have experience with EPP protocol, and we have done similar Registrars modules for PT and Carnet Registry
  10. Licensing Addon for Wordpress

    Hi, We may discuss your requirements in details here
  11. We've developed few domain registrars module for WHMCS in the past couple years, contact me here with further details about your project.
  12. Client Group Product Module

    please contact me here for Quote and ETA
  13. How to restrict ALL pages to logged in users only

    sure: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function hook_ForceEveryoneToLogin($vars) { $clientID = intval($_SESSION['uid']); $adminID = intval($_SESSION['adminid']); if ($adminID===0){ if (!in_array($vars['filename'], array("login","dologin","clientarea","pwreset", "register")) && $clientID===0){ header("Location: login.php"); exit; } } } add_hook("ClientAreaPage", 1, "hook_ForceEveryoneToLogin");
  14. Structured Data & Smarty tags

    @WHMCS Andrew true, but the following will give you error: <script> function(){ // Your code } </script> you need to add space between function() and {
×

Important Information

By using this site, you agree to our Terms of Use & Guidelines