Ir para conteúdo
View in the app

A better way to browse. Learn more.

Portal do Host

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Relatório mensal de novos clientes

Featured Replies

Postado
  • Autor

Bom, vom começar com o pé direito e postar aqui uma dicazinha maneira que postei no meu fórum, no fórum WHMCS e no Hostdime.

Eu queria saber quantos novos clientes assinaram por mês, então eu criei um novo relatório que mostra o ID, nome, status e data de cadastro do cliente.

Clica aqui pra ver a imagem de como ficou (até eu aprender a postar imagem no fórum... rs): http://www.cybernetfx.com.br/images/newclients.gif

Abaixo o código. Salve o arquivo com o nome monthly_clients.php e envie para o diretório whmcs/modules/reports:

<?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\"] = \"New Clients for \".$months[$month-1].\" \".$year;


$reportdata[\"description\"] = \"This report shows all new clients for a given month\";

$query = \"SELECT id,firstname,lastname,status,datecreated FROM tblclients WHERE datecreated LIKE \'$year-$pmonth%\' ORDER BY datecreated ASC\";


$result = mysql_query($query);


$num_rows = mysql_num_rows($result);

$reportdata[\"headertext\"] = \"Total New Clients: \" . $num_rows;

$reportdata[\"tableheadings\"] = array(\"ID\",\"Client Name\",\"Status\",\"Signup Date\");

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


    $id = $data[\"id\"];


    $clientname = \"<a>\" . $data[\"firstname\"].\" \".$data[\"lastname\"] . \"</a>\";


    $status = $data[\"status\"];


    $datecreated = $data[\"datecreated\"];


    $datecreated = fromMySQLDate($datecreated);


    $colour = \"<span style=\'color:\";


switch($status)


{


        case \"Active\":


                $colour .= \"blue\";


        break;


        case \"Inactive\":


                $colour .= \"lightgrey\";


        break;


        case \"Closed\":


                $colour .= \"red\";


        break;


}


$colour .= \";\'>\";

    $reportdata[\"tablevalues\"][] = array($id,$clientname,$colour . $status . \"</span>\",$datecreated);


}


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


if ($month==\"1\") {


    $data[\"footertext\"].=\"<a><< December \".($year-1).\"</a>\";


} else {


    $data[\"footertext\"].=\"<a><< \".$months[($month-2)].\" $year</a>\";


}


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


if ($month==\"12\") {


    $data[\"footertext\"].=\"<a>January \".($year+1).\" >></a>\";


} else {


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


}


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

?>

Espero que sirva pra alguém. :)


Postado

Bom, vom começar com o pé direito e postar aqui uma dicazinha maneira que postei no meu fórum, no fórum WHMCS e no Hostdime.

Eu queria saber quantos novos clientes assinaram por mês, então eu criei um novo relatório que mostra o ID, nome, status e data de cadastro do cliente.

Clica aqui pra ver a imagem de como ficou (até eu aprender a postar imagem no fórum... rs): http://www.cybernetfx.com.br/images/newclients.gif

Abaixo o código. Salve o arquivo com o nome monthly_clients.php e envie para o diretório whmcs/modules/reports:

<?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\\\"] = \\\"New Clients for \\\".$months[$month-1].\\\" \\\".$year;


$reportdata[\\\"description\\\"] = \\\"This report shows all new clients for a given month\\\";

$query = \\\"SELECT id,firstname,lastname,status,datecreated FROM tblclients WHERE datecreated LIKE \\\'$year-$pmonth%\\\' ORDER BY datecreated ASC\\\";


$result = mysql_query($query);


$num_rows = mysql_num_rows($result);

$reportdata[\\\"headertext\\\"] = \\\"Total New Clients: \\\" . $num_rows;

$reportdata[\\\"tableheadings\\\"] = array(\\\"ID\\\",\\\"Client Name\\\",\\\"Status\\\",\\\"Signup Date\\\");

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


    $id = $data[\\\"id\\\"];


    $clientname = \\\"<a>\\\" . $data[\\\"firstname\\\"].\\\" \\\".$data[\\\"lastname\\\"] . \\\"</a>\\\";


    $status = $data[\\\"status\\\"];


    $datecreated = $data[\\\"datecreated\\\"];


    $datecreated = fromMySQLDate($datecreated);


    $colour = \\\"<span style=\\\'color:\\\";


switch($status)


{


        case \\\"Active\\\":


                $colour .= \\\"blue\\\";


        break;


        case \\\"Inactive\\\":


                $colour .= \\\"lightgrey\\\";


        break;


        case \\\"Closed\\\":


                $colour .= \\\"red\\\";


        break;


}


$colour .= \\\";\\\'>\\\";

    $reportdata[\\\"tablevalues\\\"][] = array($id,$clientname,$colour . $status . \\\"</span>\\\",$datecreated);


}


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


if ($month==\\\"1\\\") {


    $data[\\\"footertext\\\"].=\\\"<a><< December \\\".($year-1).\\\"</a>\\\";


} else {


    $data[\\\"footertext\\\"].=\\\"<a><< \\\".$months[($month-2)].\\\" $year</a>\\\";


}


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


if ($month==\\\"12\\\") {


    $data[\\\"footertext\\\"].=\\\"<a>January \\\".($year+1).\\\" >></a>\\\";


} else {


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


}


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

?>

Espero que sirva pra alguém. :)



Postado

Valew teste aqui!



Postado

vlw Patty pela dica! Já to usando :)


Postado

Valeu Patty, boa contribuição!


Postado

Obrigado pela dica Patty! o/

Abraço.


Postado

Eu precisava muito dessa solução, sucesso PATTY!



Visitante
Este tópico está impedido de receber novos posts.

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Informação Importante

Concorda com os nossos termos?

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.