Jump to content

Report Request


Recommended Posts

I was wondering if someone could write a report that will show the following information...

 

CUSTOMER | BILLING CYCLE | LAST BILL DATE | NEXT BILL DATE | PAYMENT METHOD | $ DUE PER CYCLE

 

JOHN DOE | MONTHLY | 01/02/2008 | 02/02/2008 | CREDIT CARD | $29.99

 

I am sure there are some other fields that might make a report handy. We see its use helping with billing audits to make sure everyone is getting billed when they should. Might be nice to list the # of outstanding invoices too.

Link to comment
Share on other sites

Customers don't have 'one' billing date, each account under the customer has a billing date.

 

Would you want it Listing a customer name, then all their accounts underneath? Eg:

 

John Doe

Acct 1 | MONTHLY | 01/02/2008 | 02/02/2008 | CREDIT CARD | $29.99

Acct 2 | QUARTERLYLY | 08/02/2008 | 08/05/2008 | PAYPAL | $21.99

Link to comment
Share on other sites

Hi,

not a terrific looking report, but it's a start:

I would prefer to have the customer details on a separate line and it would be great if it would show the product add-ons, but here is version 0.01 ;)

 

<?php

 

$months = array('January','February','March','April','May','June','July','August','September','October','November','December');

 

if ($month=="") {

$month=date("m");

$year=date("Y");

}

 

$pmonth = str_pad($month, 2, "0", STR_PAD_LEFT);

 

$reportdata["title"] = "Products per customer ".$months[$month-1]." ".$year;

$reportdata["description"] = "This reports shows per customer all their products, excl. domains";

 

$query = "SELECT tblhosting.domain, tblhosting.domainstatus, tblhosting.paymentmethod, tblhosting.billingcycle, tblhosting.nextduedate, tblhosting.nextinvoicedate, tblhosting.amount, tblhosting.packageid, tblclients.id, tblclients.companyname, tblclients.firstname, tblclients.lastname, tblproducts.id, tblproducts.name FROM tblclients

LEFT JOIN tblhosting ON tblclients.id = tblhosting.userid

JOIN tblproducts ON tblproducts.id = tblhosting.packageid

ORDER BY tblclients.id ASC ";

$result = mysql_query($query);

$num_rows = mysql_num_rows($result);

 

$reportdata["headertext"] = "Products per customer: $num_rows";

 

$reportdata["tableheadings"] = array("Customer","Domainname","Status","Paymenttype","Billing Cycle","Next DueDate","Next Invoice","Amount","Pakket");

 

while ($data = mysql_fetch_array($result)) {

$domain = $data["domain"];

$paymentmethod = $data["paymentmethod"];

$billingcycle = $data["billingcycle"];

$nextduedate = $data["nextduedate"];

$nextinvoice =$data["nextinvoicedate"];

$status = $data["domainstatus"];

$clientname = $data["companyname"]." ".$data["firstname"]." ".$data["lastname"];

$invamount = $data["amount"];

$pakket = $data["name"];

$reportdata["tablevalues"][] = array("$clientname","$domain","$status","$paymentmethod","$billingcycle","$nextduedate","$nextinvoice","$invamount","$pakket");

}

 

$data["footertext"]="<table width=90% align=center><tr><td>";

 

if ($month=="1") {

$data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=12&year=".($year-1)."\"><< December ".($year-1)."</a>";

} else {

$data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=".($month-1)."&year=".$year."\"><< ".$months[($month-2)]." $year</a>";

}

$data["footertext"].="</td><td align=right>";

if ($month=="12") {

$data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=1&year=".($year+1)."\">January ".($year+1)." >></a>";

} else {

$data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=".($month+1)."&year=".$year."\">".$months[(($month+1)-1)]." $year >></a>";

}

$data["footertext"].="</td></tr></table>";

 

?>

Link to comment
Share on other sites

  • 6 months later...

Just tried and works fine for me.

 

I copied the report, fixed a few things, and named the report. Uploaded to my whmcs/modules/reports folder. Logged into WHMCS, went to reports and clicked on the new report. Worked fine for me.

 

<?php

$months = array('January','February','March','April','May',' June','July','August','September','October','November','December');

if ($month=="") {
$month=date("m");
$year=date("Y");
}

$pmonth = str_pad($month, 2, "0", STR_PAD_LEFT);

$reportdata["title"] = "Products per customer ".$months[$month-1]." ".$year;
$reportdata["description"] = "This reports shows per customer all their products, excl. domains";

$query = "SELECT tblhosting.domain, tblhosting.domainstatus, tblhosting.paymentmethod, tblhosting.billingcycle, tblhosting.nextduedate, tblhosting.nextinvoicedate, tblhosting.amount, tblhosting.packageid, tblclients.id, tblclients.companyname, tblclients.firstname, tblclients.lastname, tblproducts.id, tblproducts.name FROM tblclients
LEFT JOIN tblhosting ON tblclients.id = tblhosting.userid
JOIN tblproducts ON tblproducts.id = tblhosting.packageid
ORDER BY tblclients.id ASC ";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);

$reportdata["headertext"] = "Products per customer: $num_rows";

$reportdata["tableheadings"] = array("Customer","Domain","Status","Payment Type","Billing Cycle","Due Date","Next Invoice","Amount","Product");

while ($data = mysql_fetch_array($result)) {
$domain = $data["domain"];
$paymentmethod = $data["paymentmethod"];
$billingcycle = $data["billingcycle"];
$nextduedate = $data["nextduedate"];
$nextinvoice =$data["nextinvoicedate"];
$status = $data["domainstatus"];
$clientname = $data["companyname"]." ".$data["firstname"]." ".$data["lastname"];
$invamount = $data["amount"];
$pakket = $data["name"];
$reportdata["tablevalues"][] = array("$clientname","$domain","$status","$paymentmethod","$billingcycle","$nextduedate","$nextinvoice","$invamount","$pakket");
}

$data["footertext"]="<table width=90% align=center><tr><td>";

if ($month=="1") {
$data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=12&year=".($year-1)."\"><< December ".($year-1)."</a>";
} else {
$data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=".($month-1)."&year=".$year."\"><< ".$months[($month-2)]." $year</a>";
}
$data["footertext"].="</td><td align=right>";
if ($month=="12") {
$data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=1&year=".($year+1)."\">January ".($year+1)." >></a>";
} else {
$data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=".($month+1) ."&year=".$year."\">".$months[(($month+1)-1)]." $year >></a>";
}
$data["footertext"].="</td></tr></table>";

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated