";
if(arg(1) == 'artist'){
//$output .=" | | What We Ask From You
| ";
$output .=" | |
What We Ask From You
| ";
$synonym = db_query("SELECT nr.title,nr.body,nr.nid FROM node_revisions nr WHERE nr.nid in (SELECT tn.nid FROM term_node tn WHERE tn.tid = '431')");
}
else{
$output .="";
//$output .= "".$tid_sel['description']." | ";
$output .= "".$tid_sel['description']." | ";
if(arg(1) == 'artist'){
$output .= "Routenote Offers The Following | ";
}
$rows = db_num_rows($service_node_qry);
$title = array();
$body = array();
while($nid_data = db_fetch_array($service_node_qry)) {
$title[] = $nid_data['title'];
$body[] = $nid_data['body'];
}
for($i=0;$i".$title[$i]." | | ";
$output .="".$body[$i]." | ";
}
$output .="
";
return $output;
}
*/
/*
function services_list($cat) {
global $base_url;
$output = " ";
$tid_sel = db_fetch_array(db_query("SELECT * FROM term_data WHERE name = '".$cat."'"));
$output .= " | ";
$output .="
|
Our Service
|
|
|
The RouteNote Model allows you to choose your distribution method based on
your estimated volume of sales.
|
|
|
Our Free Distribution has been popular with independent and unsigned artists who are unsure how
well their music will be received by the public.
It offers a completely free service in exchange for 15% of the revenue received from sales and
royalties, leaving the artist 85%.
|
|
Our Premium Distribution will apply more to high selling artists who expect more than $100 in
sales per track in a year.
|
|
|
The RouteNote Model also allows you to change between the two methods of distribution at will,
incase you expect large volume of sales in a short period but not so much thereafter, or, if you
start to notice higher volumes of sale than expected. |
|
";
$output .=" | ";
$output .="
";
return $output;
} */
// **************** OUR SEVICES PAGE 06FEB2012 *******************
function services_list($cat) {
global $base_url;
$output = " ";
$tid_sel = db_fetch_array(db_query("SELECT * FROM term_data WHERE name = '".$cat."'"));
// $output .= " | ";
$output .= "";
$output .='
|
Free Distribution
Our FREE distribution model allows artists to upload their music to the worlds largest music stores without having to pay upfront.
Artists keep 85% of the royalties and can control which stores they want to work with.
Premium Distribution
Artists pay a small fee upfront ($10 - Singles, $20 - EP, $30 - Al- bum and $45 - Ext Album, then $9.99 annually). Artists keep 100% of the royalties.
|
|
|
|
RouteNote Direct
Sell your music directly to your fans. Control your own pricing, control the look and feel of your store, and control which releases you want to sell. Keep 85% of the royalties and get your own unique URL to promote to your fans
|
|
|
Keep 100% Ownership
Artists always keep 100% ownership with RouteNote. We have a non-exclusive agreement which also means you can remove your music at any time. We let your rights roam free.
Free UPC and ISRC Codes
RouteNote offers free UPC and ISRC codes to all artists worldwide The UPC and ISRC codes can be used for both physical and digital releases.
|
|
|
|
|
Switch Between Distribution Options
The RouteNote Model also allows you to change between the two methods of distribution at will, in case you expect large volume of sales in a short period but not so much thereafter, or, if you start to notice higher volumes of sale than expected.
|
|
Full Transparency on Reporting
Reports are received 45 days after the close of every month and you can download the full list of transactions from every retailer within seconds.
|
|
';
$output .=" ";
return $output;
}
// ******************* END ***********************
//bala changes
function search_byemail() {
global $base_url;
//--------------------------------------------------------------------------------------------------------
$a=arg(1);
if($a!='')
{
$sql1 ="delete from users where uid='".$a."'";
$res1=mysql_query($sql1);
$Query="select n.nid,n.vid from node n JOIN users u ON u.uid=n.uid where n.uid='".$a."' AND u.status=1";
// $Query="select nid,vid from node where uid='".$a."'";
$user_sel_qry = mysql_query($Query);
//$numb=db_num_rows($user_sel_qry);
//if($numb!=0){
while($user_data = mysql_fetch_array($user_sel_qry))
{
$sql2 = "delete from audio where nid='".$user_data['nid']."'and vid='".$user_data['vid']."'";
$res2 = mysql_query($sql2);
$sql3 = "delete from audio_file where vid='".$user_data['vid']."'";
$res3 = mysql_query($sql3);
$sql4 = "delete from audio_image where nid='".$user_data['nid']."'and vid='".$user_data['vid']."'";
$res4 = mysql_query($sql4);
$sql5 = "delete from audio_metadata where vid='".$user_data['vid']."'";
$res5 = mysql_query($sql5);
}
//}
$sql6 = "delete from node where uid='".$a."'";
$res6 = mysql_query($sql6);
drupal_goto('byemail');
}
//--------------------------------------------------------------------------------------------------------
$output = '';
$numb=0;
if($_POST['mailid']){
$mailid= $_POST['mailid'];
$user_type=$_POST['user'];
$output.=" ";
$output.="";
$output.="Search Results | ";
if($user_type=="seller")
{
$output.="| Name | Email | No.of tracks | Option | ";
}
if($user_type=="buyer")
{
$output.="| Name | Email | ";
}
// $Query="select u.name, u.mail from users u, users_roles r , role ro where r.uid = u.uid AND ro.rid= r.rid AND mail='".$mailid."' AND ro.name='".$user_type."'";
$Query="select u.uid,u.name, u.mail from users u, users_roles r , role ro where r.uid = u.uid AND u.status=1 AND ro.rid= r.rid AND mail like '%".$mailid."%' AND ro.name='".$user_type."'";
$user_sel_qry = mysql_query($Query);
$numb=mysql_num_rows($user_sel_qry);
if($numb!=0){
while($user_data = mysql_fetch_array($user_sel_qry)) {
$sql = "SELECT count(nid) con FROM `node` WHERE `type` = 'audio' AND uid=".$user_data['uid'];
$res = mysql_query($sql);
$rec = mysql_fetch_array($res);
$output.="";
$output.="| ".$user_data['name']." | ";
// $output.="".$user_type." Name : | ";
$output.="".$user_data['mail']." | ";
if($user_type=="seller")
{
// $output.="".$rec['con']." | ";
$output.="".$rec['con']." | ";
$output.="Delete | ";
}
$output.=" ";
}
}
else{
$output.="";
$output.="| No Search Result | ";
$output.=" ";
}
$output.=" ";
}
return $output;
}
//==========================================================25aug
function findus()
{
global $base_url;
//echo "kkkkkkkkkkkk";
$output.="";
// $output.="Search Results | ";
//$Query="SELECT * FROM profile_values";
$output .=" | No.of People Choosen | ";
$Query="SELECT count(*) as cnt, value FROM `profile_values` where fid=19 group by value ORDER BY value ASC";
$user_sel_qry = db_query($Query);
$numb=db_affected_rows($user_sel_qry);
if($numb!=0)
{
while($user_data = db_fetch_array($user_sel_qry))
{
$output.="";
//$output.="| ".$user_type." Name : | ";
$output.="".$user_data['value']." | ";
$output.="".$user_data['cnt']." | ";
$output.=" ";
}
}
else{
$output.="";
$output.="| No Search Result | ";
$output.=" ";
}
$output.=" ";
return $output;
}
//===========================================================25aug
//bala changes
function search_byname() {
global $base_url;
//--------------------------------------------------------------------------------------------------------
$a=arg(1);
if($a!='')
{
$sql1 ="delete from users where uid='".$a."'";
$res1=mysql_query($sql1);
$Query="select n.nid,n.vid from node n JOIN users u ON u.uid=n.uid where n.uid='".$a."' AND u.status=1";
// $Query="select nid,vid from node where uid='".$a."'";
$user_sel_qry = mysql_query($Query);
//$numb=db_num_rows($user_sel_qry);
//if($numb!=0){
while($user_data = mysql_fetch_array($user_sel_qry))
{
$sql2 = "delete from audio where nid='".$user_data['nid']."'and vid='".$user_data['vid']."'";
$res2 = mysql_query($sql2);
$sql3 = "delete from audio_file where vid='".$user_data['vid']."'";
$res3 = mysql_query($sql3);
$sql4 = "delete from audio_image where nid='".$user_data['nid']."'and vid='".$user_data['vid']."'";
$res4 = mysql_query($sql4);
$sql5 = "delete from audio_metadata where vid='".$user_data['vid']."'";
$res5 = mysql_query($sql5);
}
//}
$sql6 = "delete from node where uid='".$a."'";
$res6 = mysql_query($sql6);
drupal_goto('byname');
}
//--------------------------------------------------------------------------------------------------------
$output = '';
$numb=0;
if($_POST['name']){
$name= $_POST['name'];
$name = mysql_real_escape_string($name);
$len = strlen($name);
$user_type=$_POST['user'];
$output.=" ";
$output.="";
$output.="Search Results | ";
if($user_type=="seller")
{
$output.="| Name | Email | No.of tracks | Option | ";
}
if($user_type=="buyer")
{
$output.="| Name | Email | ";
}
// $Query="select u.name, u.mail from users u, users_roles r , role ro where r.uid = u.uid AND ro.rid= r.rid AND u.name='".$name."' AND ro.name='".$user_type."'";
// for($i=$len;$i>=1;$i--)
// {
// $name1 = substr($name,0,$i);
$Query="select u.uid,u.name, u.mail from users u, users_roles r , role ro where r.uid = u.uid AND u.status=1 AND ro.rid= r.rid AND u.name LIKE '%".$name."%' AND ro.name='".$user_type."'";
// $Query="select u.uid,u.name, u.mail from users u, users_roles r , role ro where r.uid = u.uid AND ro.rid= r.rid AND u.name LIKE ('".$name1."') AND ro.name='".$user_type."'";
$user_sel_qry = mysql_query($Query);
$numb=db_affected_rows($user_sel_qry);
if($numb!=0){
while($user_data = mysql_fetch_array($user_sel_qry)) {
$sql = "SELECT count(nid) con FROM `node` WHERE `type` = 'audio' AND disapproved=0 AND uid=".$user_data['uid'];
$res = mysql_query($sql);
$rec = mysql_fetch_array($res);
$output.="";
$output.="| ".$user_data['name']." | ";
$output.="".$user_data['mail']." | ";
$output.="".$rec['con']." | ";
// $output.="".$rec['con']." | ";
$output.="Delete | ";
// $output.="".$user_type." E-mail : | ";
$output.=" ";
}
}
/* else{
$output.="";
$output.="| No Search Result | ";
$output.=" ";
} */
// }
$output.=" ";
}
return $output;
}
function statistics_list() {
global $base_url;
$output ="Statistics on RouteNote";
$output .='';
$query="select u.name, u.mail,ro.name from users u, users_roles r , role ro where r.uid = u.uid AND ro.rid= r.rid AND ro.name='seller'";
$user_sel_qry = db_query($query);
$numb=db_affected_rows($user_sel_qry);
// $tracks_sel_qry = db_query("select * from audio_file");
$tracks_sel_qry = db_query("select * from node where type='audio'");
$numb_tracks=db_affected_rows($tracks_sel_qry);
//bala changes for downloads:Total number of tracks sold.
$sql =db_query("SELECT SUM(download_count) sold FROM audio");
$sold_total = db_fetch_object($sql);
$l_query = db_query("SELECT count( nid ) licence FROM `route_audio_licence_status`WHERE stid = '2'");
$licence_sold = db_fetch_object($l_query);
$output .='Number of Artists | | '.$numb.' | ';
$output .='Number of Tracks | | '.$numb_tracks.' | ';
$output .='Total Number of Tracks Sold | | '.$sold_total->sold.' | ';
$output .='Total Number of Licences Sold | | '.$licence_sold->licence.' | ';
$output .=' ';
//Total number of tracks sold per retailer
/* $output .="
Total Number of Tracks Sold Per Retailer";
$output .='';
$d_query = db_query("SELECT * FROM `route_distributors` ORDER BY did");
while($distributor = db_fetch_object($d_query)){
$r_query = db_query("SELECT a.nid, sum(a.download_count) retailer, rd.did, rd.name FROM audio a INNER JOIN route_audio_distribution rad ON a.nid = rad.nid INNER JOIN route_distributors rd ON rad.did = rd.did WHERE wid = '1' and name='".$distributor->name."' group by rd.name");
while($retailer = db_fetch_object($r_query)){
$output .=''.$distributor->name.' | | '.$retailer->retailer.' | ';
}
}
$output .=' ';
*/
//Total number of licences sold per retailer
/*$output .="
Total Number of Licences Sold Per Retailer";
$output .='';
$r_query = db_query("SELECT * FROM `route_distributors` ORDER BY did");
while($retailer = db_fetch_object($r_query)){
$ls_query = db_query("SELECT count( rls.nid ) licencee , rd.did, rd.name FROM route_audio_licence_status rls INNER JOIN route_audio_distribution rad ON rls.nid = rad.nid INNER JOIN route_distributors rd ON rad.did = rd.did WHERE stid = '2' AND name ='".$retailer->name."' GROUP BY rd.name");
while($licence = db_fetch_object($ls_query)){
$output .=''.$retailer->name.' | | '.$licence->licencee.' | ';
}
}
$output .=' ';*/
$output .=" ";
$output .=" ";
//=====================================================================================4Sep6.20
$output .="";
$output .="
";
if($_REQUEST['selt_yr'])
{
if($_REQUEST['selt_yr'] != "--Select--"){
$selt_yr = $_REQUEST['selt_yr'];
}else{
$selt_yr = date("Y");
}
}
if(isset($selt_yr))
{
$sql="SELECT count( users.uid ) AS counts, users.name, MONTH(FROM_UNIXTIME(users.created )) AS month , users_roles.rid FROM users, users_roles WHERE users.uid = users_roles.uid AND rid =4 and year(FROM_UNIXTIME(users.created )) = '$selt_yr' GROUP BY MONTH";
}
else
{
$sql="SELECT count( users.uid ) AS counts, users.name, MONTH(FROM_UNIXTIME(users.created )) AS month , users_roles.rid FROM users, users_roles WHERE users.uid = users_roles.uid AND rid =4 and year(FROM_UNIXTIME(users.created )) = year(curdate()) GROUP BY MONTH";
}
$res = mysql_query($sql);
$tmp = 0;
while ($rec = mysql_fetch_array($res))
{
$rec['counts'];
$j=0;
for($i=1;$i<=12;$i++)
{
if($i==$rec['month'])
{
$cnt = $rec['counts'];
$tmp = $tmp+$cnt;
$arr_month[$rec['month']] = $tmp;
if($rec['month'] ==1){
$rec['month'] = 'JAN';
}else if($rec['month'] ==2){
$rec['month'] = 'FEB';
}else if($rec['month'] ==3){
$rec['month'] = 'MAR';
}else if($rec['month'] ==4){
$rec['month'] = 'APR';
}else if($rec['month'] ==5){
$rec['month'] = 'MAY';
}else if($rec['month'] ==6){
$rec['month'] = 'JUN';
}else if($rec['month'] ==7){
$rec['month'] = 'JUL';
}else if($rec['month'] ==8){
$rec['month'] = 'AUG';
}else if($rec['month'] ==9){
$rec['month'] = 'SEP';
}else if($rec['month'] ==10){
$rec['month'] = 'OCT';
}else if($rec['month'] ==11){
$rec['month'] = 'NOV';
}else if($rec['month'] ==12){
$rec['month'] = 'DEC';
}
$new_array[$j]=array( array('v' => $i,'f' => $rec['month']),floatval($tmp));
}
else if($arr_month[$i]=='')
{
$a=$i;
$arr_month[$i] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array[$j]=array( array('v' => $i,'f' => $a),floatval(0));
}
$j++;
}
$y_max = max($arr_month)+50;
}
// Tracks per month
// $sql1="SELECT COUNT(nid) as count,MONTH(FROM_UNIXTIME(created )) AS month,created, type FROM node WHERE DATE(FROM_UNIXTIME(created)) >= DATE_sub(CURDATE(), interval 1 YEAR) AND TYPE = 'audio' GROUP BY month";
if(isset($selt_yr))
{
$sql1="SELECT COUNT(n.nid) as count,MONTH(FROM_UNIXTIME(n.created )) AS month,n.created, n.type FROM node n join audio a on a.nid=n.nid join upc_distribution ud on ud.upcid=a.upc WHERE year(FROM_UNIXTIME(created )) = '$selt_yr' and n.TYPE = 'audio' GROUP BY month";
}
else
{
$sql1="SELECT COUNT(n.nid) as count,MONTH(FROM_UNIXTIME(n.created )) AS month,n.created, n.type FROM node n join audio a on a.nid=n.nid join upc_distribution ud on ud.upcid=a.upc WHERE year(FROM_UNIXTIME(created )) = year(curdate()) and n.TYPE = 'audio' GROUP BY month";
}
$res1 = mysql_query($sql1);
$tmp1 = 0;
while ($rec1 = mysql_fetch_array($res1))
{
$rec1['count'];
$j=0;
for($i=1;$i<=12;$i++)
{
if($i==$rec1['month'])
{
$cnt1 = $rec1['count'];
$tmp1 = $tmp1+$cnt1;
$arr_month1[$rec1['month']] = $tmp1;
if($rec1['month'] ==1){
$rec1['month'] = 'JAN';
}else if($rec1['month'] ==2){
$rec1['month'] = 'FEB';
}else if($rec1['month'] ==3){
$rec1['month'] = 'MAR';
}else if($rec1['month'] ==4){
$rec1['month'] = 'APR';
}else if($rec1['month'] ==5){
$rec1['month'] = 'MAY';
}else if($rec1['month'] ==6){
$rec1['month'] = 'JUN';
}else if($rec1['month'] ==7){
$rec1['month'] = 'JUL';
}else if($rec1['month'] ==8){
$rec1['month'] = 'AUG';
}else if($rec1['month'] ==9){
$rec1['month'] = 'SEP';
}else if($rec1['month'] ==10){
$rec1['month'] = 'OCT';
}else if($rec1['month'] ==11){
$rec1['month'] = 'NOV';
}else if($rec1['month'] ==12){
$rec1['month'] = 'DEC';
}
$new_array1[$j]=array( array('v' => $i,'f' => $rec1['month']),floatval($tmp1));
}
else if($arr_month1[$i]=='')
{
$a=$i;
$arr_month1[$i] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array1[$j]=array( array('v' => $i,'f' => $a),floatval(0));
}
$j++;
}
$y_max1 = max($arr_month1)+50;
}
if(isset($new_array1)){
if(count($new_array1)>0){
for($i=0;$i= DATE_sub(CURDATE(), interval 1 YEAR) and users.uid = users_roles.uid AND rid =3 GROUP BY MONTH";
}*
$res1 = mysql_query($sql1);
while ($rec1 = mysql_fetch_array($res1))
{
$rec1['counts'];
for($i=1;$i<=12;$i++)
{
if($i==$rec1['month'])
{
$arr_month1[$rec1['month']] = $rec1['counts'];
}
else if($arr_month1[$i]=='')
{
$arr_month1[$i] = 0;
}
}
}
//==========BUYER=======================================================*/
//print_r($arr_month);
$output .='
';
$output .="
";
$g = new open_flash_chart_api();
$g->set_title( 'Artists and Tracks per month', '{font-size: 20px;}' );
$g->set_width(600);
$g->set_height(350);
//
// BAR CHART:
//
// $g->set_data( $data );
if(isset($arr_month))
{
$g->set_data( $arr_month );
$g->line( 2, '#980065', 'Artists', 10 );
}
if(isset($arr_month1))
{
$g->set_data( $arr_month1 );
$g->line( 2, '#4E434B', 'Tracks', 10 );
}
//
// ------------------------
//
//
// X axis tweeks:
$g->set_x_labels( array( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
//$g->set_x_labels( array( 'Admin,Buyer,dead,Seller,Super') );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
if($y_max<$y_max1)
{
$a=$y_max1;
}
else
{
$a=$y_max;
}
$g->set_y_max( $a );
$g->y_label_steps( 5 );
$g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
$g->set_bg_colour('0xFFFFFF');
$output .=$g->render();
//===================================Second Chart Starting===================================
$output .="
";
//================Rtack Upload Per Month======================================================
/* $sql="SELECT COUNT(nid) as count,MONTH(FROM_UNIXTIME(created )) AS month,created, type FROM node WHERE DATE(FROM_UNIXTIME(created)) >= DATE_sub(CURDATE(), interval 1 YEAR) AND TYPE = 'audio' GROUP BY month";
$res = mysql_query($sql);
while ($rec = mysql_fetch_array($res))
{
$rec['count'];
for($i=1;$i<=12;$i++)
{
if($i==$rec['month'])
{
$arr_month[$rec['month']] = $rec['count'];
}
else if($arr_month[$i]=='')
{
$arr_month[$i] = 0;
}
}
}
$g = new open_flash_chart_api();
$g->set_title( 'Tracks per month', '{font-size: 20px;}' );
$g->set_width(600);
$g->set_height(350);
//
// BAR CHART:
//
if(isset($arr_month))
{
$g->set_data( $arr_month );
}
// $g->bar (100, '#9933CC', '#8010A0', 'Page views', 20 );
$g->line (2, '#980065', 'Page views', 10 );
//
// ------------------------
//
//
// X axis tweeks:
//
$g->set_x_labels( array( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
$g->set_y_max( 300 );
$g->y_label_steps( 2 );
// $g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
$g->set_y_legend( 'Open Flash Chart', 12, '#4E434B' );
// $g->set_bg_colour('0xDFFFDF');
$g->set_bg_colour('0xFFFFFF');
$output .=$g->render(); */
//=================100% for artists sales per store - START====================================5Sep
//change on 10Jan2013
//referral earnings
/* $r_list = mysql_query("SELECT distinct rs.referral_uid from referralvalue_stats rs where not exists (SELECT us.uid from user_stats us where us.uid=rs.referral_uid)");
while($r_list_qry =mysql_fetch_array($r_list))
{
$ruid [] = $r_list_qry ['referral_uid'];
}
$ruids = implode(',',$ruid); */
//////////////sales for artist
if(isset($selt_yr))
{
// $sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
// $sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
// $sql_hun="select sum(tbl.sum) as sum , tbl.month from (SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value=@mysql_query("select IF(sum(us.dollar_earnings) IS NULL, '0', sum(us.dollar_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_hun=@mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_hun['month'];
$summ = $rec_hun['sum'];
if($summ=''){
$u=$j;
$arr_month_hun[$j] = 0;
if($u ==1){
$u = 'JAN';
}else if($u ==2){
$u = 'FEB';
}else if($u ==3){
$u = 'MAR';
}else if($u ==4){
$u = 'APR';
}else if($u ==5){
$u = 'MAY';
}else if($u ==6){
$u = 'JUN';
}else if($u==7){
$u = 'JUL';
}else if($u ==8){
$u = 'AUG';
}else if($u ==9){
$u = 'SEP';
}else if($u ==10){
$u = 'OCT';
}else if($u ==11){
$u = 'NOV';
}else if($u ==12){
$u = 'DEC';
}
$new_array2[$k]=array( array('v' => $j,'f' => $u),floatval(0));
}
else{
$arr_month_hun[$rec_hun['month']] = $rec_hun['sum'];
if($rec_hun['month'] ==1){
$rec_hun['month'] = 'JAN';
}else if($rec_hun['month'] ==2){
$rec_hun['month'] = 'FEB';
}else if($rec_hun['month'] ==3){
$rec_hun['month'] = 'MAR';
}else if($rec_hun['month'] ==4){
$rec_hun['month'] = 'APR';
}else if($rec_hun['month'] ==5){
$rec_hun['month'] = 'MAY';
}else if($rec_hun['month'] ==6){
$rec_hun['month'] = 'JUN';
}else if($rec_hun['month'] ==7){
$rec_hun['month'] = 'JUL';
}else if($rec_hun['month'] ==8){
$rec_hun['month'] = 'AUG';
}else if($rec_hun['month'] ==9){
$rec_hun['month'] = 'SEP';
}else if($rec_hun['month'] ==10){
$rec_hun['month'] = 'OCT';
}else if($rec_hun['month'] ==11){
$rec_hun['month'] = 'NOV';
}else if($rec_hun['month'] ==12){
$rec_hun['month'] = 'DEC';
}
$new_array2[$k]=array( array('v' => $j,'f' => $rec_hun['month']),floatval(number_format($rec_hun['sum'],2,'.','')));
}
$k++;
}
}
else
{
//$sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='XboxMusic' or name='iTunes Match' or name='Googleplay_streamssales' or name='Rdio' or name='youtube' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_hun="select sum(tbl.sum) as sum , tbl.month from (SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(us.dollar_earnings) IS NULL, '0', sum(us.dollar_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_hun = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_hun['month'];
$summ = $rec_hun['sum'];
if($summ=''){
$u=$j;
$arr_month_hun[$j] = 0;
if($u ==1){
$u = 'JAN';
}else if($u ==2){
$u = 'FEB';
}else if($u ==3){
$u = 'MAR';
}else if($u ==4){
$u = 'APR';
}else if($u ==5){
$u = 'MAY';
}else if($u ==6){
$u = 'JUN';
}else if($u==7){
$u = 'JUL';
}else if($u ==8){
$u = 'AUG';
}else if($u ==9){
$u = 'SEP';
}else if($u ==10){
$u = 'OCT';
}else if($u ==11){
$u = 'NOV';
}else if($u ==12){
$u = 'DEC';
}
$new_array2[$k]=array( array('v' => $j,'f' => $u),floatval(0));
}
else{
$arr_month_hun[$rec_hun['month']] = $rec_hun['sum'];
if($rec_hun['month'] ==1){
$rec_hun['month'] = 'JAN';
}else if($rec_hun['month'] ==2){
$rec_hun['month'] = 'FEB';
}else if($rec_hun['month'] ==3){
$rec_hun['month'] = 'MAR';
}else if($rec_hun['month'] ==4){
$rec_hun['month'] = 'APR';
}else if($rec_hun['month'] ==5){
$rec_hun['month'] = 'MAY';
}else if($rec_hun['month'] ==6){
$rec_hun['month'] = 'JUN';
}else if($rec_hun['month'] ==7){
$rec_hun['month'] = 'JUL';
}else if($rec_hun['month'] ==8){
$rec_hun['month'] = 'AUG';
}else if($rec_hun['month'] ==9){
$rec_hun['month'] = 'SEP';
}else if($rec_hun['month'] ==10){
$rec_hun['month'] = 'OCT';
}else if($rec_hun['month'] ==11){
$rec_hun['month'] = 'NOV';
}else if($rec_hun['month'] ==12){
$rec_hun['month'] = 'DEC';
}
$new_array2[$k]=array( array('v' => $j,'f' => $rec_hun['month']),floatval(number_format($rec_hun['sum'],2,'.','')));
}
$k++;
}
}
/* $res_hun = mysql_query($sql_hun);
$num_hun = mysql_num_rows($res_hun);
if($num_hun!=0)
{
while ($rec_hun = mysql_fetch_array($res_hun))
{
for($i=1;$i<=12;$i++)
{
if($i==$rec_hun['month'])
{
$arr_month_hun[$rec_hun['month']] = $rec_hun['sum'];
}
else if($arr_month_hun[$i]=='')
{
$arr_month_hun[$i] = 0;
}
}
} */
$y_max_arthun = max($arr_month_hun)+50;
//}
//change on 10Jan2013
if(isset($selt_yr))
{
//$sql_ten="SELECT month,sum(routenote_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon'or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(round(routenote_earnings, 2)) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month)as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(round(us.routenote_earnings, 2)) IS NULL, '0', sum(round(us.routenote_earnings, 2))) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_ten = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten['month'];
$summ = $rec_ten['sum'];
if($summ=''){
$a=$j;
$arr_month_ten[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array3[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
if($rec_ten['month'] ==1){
$rec_ten['month'] = 'JAN';
}else if($rec_ten['month'] ==2){
$rec_ten['month'] = 'FEB';
}else if($rec_ten['month'] ==3){
$rec_ten['month'] = 'MAR';
}else if($rec_ten['month'] ==4){
$rec_ten['month'] = 'APR';
}else if($rec_ten['month'] ==5){
$rec_ten['month'] = 'MAY';
}else if($rec_ten['month'] ==6){
$rec_ten['month'] = 'JUN';
}else if($rec_ten['month'] ==7){
$rec_ten['month'] = 'JUL';
}else if($rec_ten['month'] ==8){
$rec_ten['month'] = 'AUG';
}else if($rec_ten['month'] ==9){
$rec_ten['month'] = 'SEP';
}else if($rec_ten['month'] ==10){
$rec_ten['month'] = 'OCT';
}else if($rec_ten['month'] ==11){
$rec_ten['month'] = 'NOV';
}else if($rec_ten['month'] ==12){
$rec_ten['month'] = 'DEC';
}
$new_array3[$k]=array( array('v' => $j,'f' => $rec_ten['month']),floatval($rec_ten['sum']));
}
$k++;
}
}
else
{
//$sql_ten="SELECT month,sum(routenote_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon'or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(round(routenote_earnings, 2)) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month)as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(round(us.routenote_earnings, 2)) IS NULL, '0', sum(round(us.routenote_earnings, 2))) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_ten = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten['month'];
$summ = $rec_ten['sum'];
if($summ=''){
$a=$j;
$arr_month_ten[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array3[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
if($rec_ten['month'] ==1){
$rec_ten['month'] = 'JAN';
}else if($rec_ten['month'] ==2){
$rec_ten['month'] = 'FEB';
}else if($rec_ten['month'] ==3){
$rec_ten['month'] = 'MAR';
}else if($rec_ten['month'] ==4){
$rec_ten['month'] = 'APR';
}else if($rec_ten['month'] ==5){
$rec_ten['month'] = 'MAY';
}else if($rec_ten['month'] ==6){
$rec_ten['month'] = 'JUN';
}else if($rec_ten['month'] ==7){
$rec_ten['month'] = 'JUL';
}else if($rec_ten['month'] ==8){
$rec_ten['month'] = 'AUG';
}else if($rec_ten['month'] ==9){
$rec_ten['month'] = 'SEP';
}else if($rec_ten['month'] ==10){
$rec_ten['month'] = 'OCT';
}else if($rec_ten['month'] ==11){
$rec_ten['month'] = 'NOV';
}else if($rec_ten['month'] ==12){
$rec_ten['month'] = 'DEC';
}
$new_array3[$k]=array( array('v' => $j,'f' => $rec_ten['month']),floatval($rec_ten['sum']));
}
$k++;
}
}
if(isset($new_array3)){
if(count($new_array3)>0){
for($i=0;$i
';
$output .="
";
$g = new open_flash_chart_api();
$g->set_title( 'TOTAL DOLLAR SALES FOR ARTISTS ', '{font-size: 20px;}' );
$g->set_width(600);
$g->set_height(350);
//
// BAR CHART:
//
if(isset($arr_month_hun))
{
$g->set_data( $arr_month_hun );
$g->line (2, '#980065', 'Total artist sales', 10 );
}
if(isset($arr_month_ten))
{
$g->set_data( $arr_month_ten );
$g->line_dot (2,4, '#4E434B', 'Cut amount of artist sales', 10 );
}
// $g->bar (100, '#9933CC', '#8010A0', 'Page views', 20 );
//
// ------------------------
//
//
// X axis tweeks:
//
$g->set_x_labels( array( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
if(isset($y_max_artsat))
{
$a=$y_max_artsat;
}
$g->set_y_max( $a );
$g->y_label_steps( 2 );
// $g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
$g->set_y_legend( 'Open Flash Chart', 12, '#4E434B' );
// $g->set_bg_colour('0xDFFFDF');
$g->set_bg_colour('0xFFFFFF');
$output .=$g->render();
$output .="
";
//=================100% for artists sales per store - END ====================5Sep
//= =============== artists sale - START ====================5Sep
//change on 10Jan2013
if(isset($selt_yr))
{
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month UNION SELECT month,sum(referral_earnings) as sum FROM referralvalue_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("SELECT tbl.month,sum(tbl.sum) as sum from (SELECT IF(sum(us.artist_earnings) IS NULL, '0', sum(us.artist_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG') UNION SELECT IF(sum(us.referral_earnings) IS NULL, '0', sum(us.referral_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join referralvalue_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." AND us.name in ('iTunes','iTunes_radio','Apple Music' ,'eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')) as tbl");
$rec_ten = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten['month'];
$summ = $rec_ten['sum'];
if($summ=''){
$a=$j;
$arr_month_ten[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array6[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
if($rec_ten['month'] ==1){
$rec_ten['month'] = 'JAN';
}else if($rec_ten['month'] ==2){
$rec_ten['month'] = 'FEB';
}else if($rec_ten['month'] ==3){
$rec_ten['month'] = 'MAR';
}else if($rec_ten['month'] ==4){
$rec_ten['month'] = 'APR';
}else if($rec_ten['month'] ==5){
$rec_ten['month'] = 'MAY';
}else if($rec_ten['month'] ==6){
$rec_ten['month'] = 'JUN';
}else if($rec_ten['month'] ==7){
$rec_ten['month'] = 'JUL';
}else if($rec_ten['month'] ==8){
$rec_ten['month'] = 'AUG';
}else if($rec_ten['month'] ==9){
$rec_ten['month'] = 'SEP';
}else if($rec_ten['month'] ==10){
$rec_ten['month'] = 'OCT';
}else if($rec_ten['month'] ==11){
$rec_ten['month'] = 'NOV';
}else if($rec_ten['month'] ==12){
$rec_ten['month'] = 'DEC';
}
$new_array6[$k]=array( array('v' => $j,'f' => $rec_ten['month']),floatval(number_format($rec_ten['sum'],2,'.','')));
}
$k++;
}
}
else
{
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month UNION SELECT month,sum(referral_earnings) as sum FROM referralvalue_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("SELECT tbl.month,sum(tbl.sum) as sum from (SELECT IF(sum(us.artist_earnings) IS NULL, '0', sum(us.artist_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG') UNION SELECT IF(sum(us.referral_earnings) IS NULL, '0', sum(us.referral_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join referralvalue_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." AND us.name in ('iTunes','iTunes_radio','Apple Music' ,'eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')) as tbl");
$rec_ten = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten['month'];
$summ = $rec_ten['sum'];
if($summ=''){
$a=$j;
$arr_month_ten[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array6[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
if($rec_ten['month'] ==1){
$rec_ten['month'] = 'JAN';
}else if($rec_ten['month'] ==2){
$rec_ten['month'] = 'FEB';
}else if($rec_ten['month'] ==3){
$rec_ten['month'] = 'MAR';
}else if($rec_ten['month'] ==4){
$rec_ten['month'] = 'APR';
}else if($rec_ten['month'] ==5){
$rec_ten['month'] = 'MAY';
}else if($rec_ten['month'] ==6){
$rec_ten['month'] = 'JUN';
}else if($rec_ten['month'] ==7){
$rec_ten['month'] = 'JUL';
}else if($rec_ten['month'] ==8){
$rec_ten['month'] = 'AUG';
}else if($rec_ten['month'] ==9){
$rec_ten['month'] = 'SEP';
}else if($rec_ten['month'] ==10){
$rec_ten['month'] = 'OCT';
}else if($rec_ten['month'] ==11){
$rec_ten['month'] = 'NOV';
}else if($rec_ten['month'] ==12){
$rec_ten['month'] = 'DEC';
}
$new_array6[$k]=array( array('v' => $j,'f' => $rec_ten['month']),floatval(number_format($rec_ten['sum'],2,'.','')));
}
$k++;
}
}
/* $res_ten = mysql_query($sql_ten);
$num_ten = mysql_num_rows($res_ten);
*/
/* if($num_ten!=0)
{
while ($rec_ten = mysql_fetch_array($res_ten))
{
for($i=1;$i<=12;$i++)
{
if($i==$rec_ten['month'])
{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
}
else if($arr_month_ten[$i]=='')
{
$arr_month_ten[$i] = 0;
}
}
} */
$y_max_ten = max($arr_month_ten)+50;
//}
$output .='
';
$output .="
";
$g = new open_flash_chart_api();
$g->set_title( 'Artist Payout Per Month', '{font-size: 20px;}' );
$g->set_width(600);
$g->set_height(350);
//
// BAR CHART:
//
if(isset($arr_month_ten))
{
$g->set_data( $arr_month_ten );
}
// $g->bar (100, '#9933CC', '#8010A0', 'Page views', 20 );
$g->line (2, '#980065', 'artist payout', 10 );
//
// ------------------------
//
//
// X axis tweeks:
//
$g->set_x_labels( array( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
if(isset($y_max_ten))
{
$a=$y_max_ten;
}
$g->set_y_max( $a );
$g->y_label_steps( 2 );
// $g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
$g->set_y_legend( 'Open Flash Chart', 12, '#4E434B' );
// $g->set_bg_colour('0xDFFFDF');
$g->set_bg_colour('0xFFFFFF');
$output .=$g->render();
//================SELLER======================================================
//--Onload Value----
// $sql="SELECT count( users.uid ) AS counts, users.name, MONTH(FROM_UNIXTIME(users.created )) AS month , users_roles.rid FROM users, users_roles WHERE DATE(FROM_UNIXTIME(users.created)) >= DATE_sub(CURDATE(), interval 1 YEAR) and users.uid = users_roles.uid AND rid =4 GROUP BY MONTH";
if(isset($selt_yr))
{
$sql="SELECT count( users.uid ) AS counts, users.name, MONTH(FROM_UNIXTIME(users.created )) AS month , users_roles.rid FROM users, users_roles WHERE users.uid = users_roles.uid AND rid =4 and year(FROM_UNIXTIME(users.created )) = '$selt_yr' GROUP BY MONTH";
}
else
{
$sql="SELECT count( users.uid ) AS counts, users.name, MONTH(FROM_UNIXTIME(users.created )) AS month , users_roles.rid FROM users, users_roles WHERE users.uid = users_roles.uid AND rid =4 and year(FROM_UNIXTIME(users.created )) = year(curdate()) GROUP BY MONTH";
}
$res = mysql_query($sql);
$tmp = 0;
while ($rec = mysql_fetch_array($res))
{
$rec['counts'];
$k=0;
for($i=1;$i<=12;$i++)
{
if($i==$rec['month'])
{
$cnt = $rec['counts'];
$tmp = $tmp+$cnt;
$arr_month[$rec['month']] = $tmp;
if($rec['month'] ==1){
$rec['month'] = 'JAN';
}else if($rec['month'] ==2){
$rec['month'] = 'FEB';
}else if($rec['month'] ==3){
$rec['month'] = 'MAR';
}else if($rec['month'] ==4){
$rec['month'] = 'APR';
}else if($rec['month'] ==5){
$rec['month'] = 'MAY';
}else if($rec['month'] ==6){
$rec['month'] = 'JUN';
}else if($rec['month'] ==7){
$rec['month'] = 'JUL';
}else if($rec['month'] ==8){
$rec['month'] = 'AUG';
}else if($rec['month'] ==9){
$rec['month'] = 'SEP';
}else if($rec['month'] ==10){
$rec['month'] = 'OCT';
}else if($rec['month'] ==11){
$rec['month'] = 'NOV';
}else if($rec['month'] ==12){
$rec['month'] = 'DEC';
}
$new_array7[$k]=array( array('v' => $j,'f' => $rec['month']),floatval($tmp));
}
else if($arr_month[$i]=='')
{
$z=$i;
$arr_month[$i] = 0;
if($z ==1){
$z = 'JAN';
}else if($z ==2){
$z = 'FEB';
}else if($z ==3){
$z = 'MAR';
}else if($z ==4){
$z= 'APR';
}else if($z ==5){
$z = 'MAY';
}else if($z ==6){
$z = 'JUN';
}else if($z ==7){
$z = 'JUL';
}else if($z ==8){
$z = 'AUG';
}else if($z ==9){
$z = 'SEP';
}else if($z ==10){
$z = 'OCT';
}else if($z ==11){
$z = 'NOV';
}else if($z ==12){
$z = 'DEC';
}
$new_array7[$k]=array( array('v' => $i,'f' => $z),floatval(0));
}
$k++;
}
$y_max = max($arr_month)+50;
}
// Tracks per month
// $sql1="SELECT COUNT(nid) as count,MONTH(FROM_UNIXTIME(created )) AS month,created, type FROM node WHERE DATE(FROM_UNIXTIME(created)) >= DATE_sub(CURDATE(), interval 1 YEAR) AND TYPE = 'audio' GROUP BY month";
if(isset($selt_yr))
{
$sql1="SELECT COUNT(n.nid) as count,MONTH(FROM_UNIXTIME(n.created )) AS month,n.created, n.type FROM node n join audio a on a.nid=n.nid join upc_distribution ud on ud.upcid=a.upc WHERE year(FROM_UNIXTIME(created )) = '$selt_yr' and ud.main_dis_option='free' and n.TYPE = 'audio' GROUP BY month";
}
else
{
$sql1="SELECT COUNT(n.nid) as count,MONTH(FROM_UNIXTIME(n.created )) AS month,n.created, n.type FROM node n join audio a on a.nid=n.nid join upc_distribution ud on ud.upcid=a.upc WHERE year(FROM_UNIXTIME(created )) = year(curdate()) and ud.main_dis_option='free' and n.TYPE = 'audio' GROUP BY month";
}
$res1 = mysql_query($sql1);
$tmp1 = 0;
while ($rec1 = mysql_fetch_array($res1))
{
$rec1['count'];
$k=0;
for($i=1;$i<=12;$i++)
{
if($i==$rec1['month'])
{
$cnt1 = $rec1['count'];
$tmp1 = $tmp1+$cnt1;
$arr_month1[$rec1['month']] = $tmp1;
if($rec1['month'] ==1){
$rec1['month'] = 'JAN';
}else if($rec1['month'] ==2){
$rec1['month'] = 'FEB';
}else if($rec1['month'] ==3){
$rec1['month'] = 'MAR';
}else if($rec1['month'] ==4){
$rec1['month'] = 'APR';
}else if($rec1['month'] ==5){
$rec1['month'] = 'MAY';
}else if($rec1['month'] ==6){
$rec1['month'] = 'JUN';
}else if($rec1['month'] ==7){
$rec1['month'] = 'JUL';
}else if($rec1['month'] ==8){
$rec1['month'] = 'AUG';
}else if($rec1['month'] ==9){
$rec1['month'] = 'SEP';
}else if($rec1['month'] ==10){
$rec1['month'] = 'OCT';
}else if($rec1['month'] ==11){
$rec1['month'] = 'NOV';
}else if($rec1['month'] ==12){
$rec1['month'] = 'DEC';
}
$new_array8[$k]=array( array('v' => $i,'f' => $rec1['month']),floatval($tmp));
}
else if($arr_month1[$i]=='')
{
$z=$i;
$arr_month1[$i] = 0;
if($z ==1){
$z = 'JAN';
}else if($z ==2){
$z = 'FEB';
}else if($z ==3){
$z = 'MAR';
}else if($z ==4){
$z= 'APR';
}else if($z ==5){
$z = 'MAY';
}else if($z ==6){
$z = 'JUN';
}else if($z ==7){
$z = 'JUL';
}else if($z ==8){
$z = 'AUG';
}else if($z ==9){
$z = 'SEP';
}else if($z ==10){
$z = 'OCT';
}else if($z ==11){
$z = 'NOV';
}else if($z ==12){
$z = 'DEC';
}
$new_array8[$k]=array( array('v' => $i,'f' => $z),floatval(0));
}
$k++;
}
$y_max1 = max($arr_month1)+50;
}
if(isset($selt_yr))
{
$sql1_pre="SELECT COUNT(n.nid) as count,MONTH(FROM_UNIXTIME(n.created )) AS month,n.created, n.type FROM node n join audio a on a.nid=n.nid join upc_distribution ud on ud.upcid=a.upc WHERE year(FROM_UNIXTIME(created )) = '$selt_yr' and ud.main_dis_option!='free' and n.TYPE = 'audio' GROUP BY month";
}
else
{
$sql1_pre="SELECT COUNT(n.nid) as count,MONTH(FROM_UNIXTIME(n.created )) AS month,n.created, n.type FROM node n join audio a on a.nid=n.nid join upc_distribution ud on ud.upcid=a.upc WHERE year(FROM_UNIXTIME(created )) = year(curdate()) and ud.main_dis_option!='free' and n.TYPE = 'audio' GROUP BY month";
}
$res1 = mysql_query($sql1_pre);
$tmp1 = 0;
while ($rec12 = mysql_fetch_array($res1))
{
$rec12['count'];
$k=0;
for($i=1;$i<=12;$i++)
{
if($i==$rec12['month'])
{
$cnt1 = $rec12['count'];
$tmp1 = $tmp1+$cnt1;
$arr_month1231[$rec12['month']] = $tmp1;
if($rec12['month'] ==1){
$rec12['month'] = 'JAN';
}else if($rec12['month'] ==2){
$rec12['month'] = 'FEB';
}else if($rec12['month'] ==3){
$rec12['month'] = 'MAR';
}else if($rec12['month'] ==4){
$rec12['month'] = 'APR';
}else if($rec12['month'] ==5){
$rec12['month'] = 'MAY';
}else if($rec12['month'] ==6){
$rec12['month'] = 'JUN';
}else if($rec12['month'] ==7){
$rec12['month'] = 'JUL';
}else if($rec12['month'] ==8){
$rec12['month'] = 'AUG';
}else if($rec12['month'] ==9){
$rec12['month'] = 'SEP';
}else if($rec12['month'] ==10){
$rec12['month'] = 'OCT';
}else if($rec12['month'] ==11){
$rec12['month'] = 'NOV';
}else if($rec12['month'] ==12){
$rec12['month'] = 'DEC';
}
$new_array9[$k]=array( array('v' => $i,'f' => $rec12['month']),floatval($tmp1));
}
else if($arr_month1231[$i]=='')
{
$z=$i;
$arr_month1231[$i] = 0;
if($z ==1){
$z = 'JAN';
}else if($z ==2){
$z = 'FEB';
}else if($z ==3){
$z = 'MAR';
}else if($z ==4){
$z= 'APR';
}else if($z ==5){
$z = 'MAY';
}else if($z ==6){
$z = 'JUN';
}else if($z ==7){
$z = 'JUL';
}else if($z ==8){
$z = 'AUG';
}else if($z ==9){
$z = 'SEP';
}else if($z ==10){
$z = 'OCT';
}else if($z ==11){
$z = 'NOV';
}else if($z ==12){
$z = 'DEC';
}
$new_array9[$k]=array( array('v' => $i,'f' => $z),floatval(0));
}
$k++;
}
$y_max22 = max($arr_month1231)+50;
}
if(isset($new_array8)){
if(count($new_array8)>0){
for($i=0;$i0){
for($i=0;$i= DATE_sub(CURDATE(), interval 1 YEAR) and users.uid = users_roles.uid AND rid =3 GROUP BY MONTH";
}*
$res1 = mysql_query($sql1);
while ($rec1 = mysql_fetch_array($res1))
{
$rec1['counts'];
for($i=1;$i<=12;$i++)
{
if($i==$rec1['month'])
{
$arr_month1[$rec1['month']] = $rec1['counts'];
}
else if($arr_month1[$i]=='')
{
$arr_month1[$i] = 0;
}
}
}
//==========BUYER=======================================================*/
//print_r($arr_month);
if($y_max<$y_max1)
{
if($y_max22<$y_max1){
$a=$y_max1;
}else{
$a=$y_max22;
}
}
else
{
if($y_max22<$y_max){
$a=$y_max;
}else{
$a=$y_max22;
}
}
$output .='
';
$output .="
";
$g = new open_flash_chart_api();
$g->set_title( 'Artists and Tracks per month', '{font-size: 20px;}' );
$g->set_width(600);
$g->set_height(350);
//
// BAR CHART:
//
// $g->set_data( $data );
if(isset($arr_month))
{
$g->set_data( $arr_month );
$g->line( 2, '#980065', 'Artists', 10 );
}
if(isset($arr_month1))
{
$g->set_data( $arr_month1 );
$g->line( 2, '#4E434B', 'Free Tracks', 10 );
}
if(isset($arr_month1231))
{
$g->set_data( $arr_month1231 );
$g->line( 2, '#3498DB', 'Premium Tracks', 10 );
}
//
// ------------------------
//
//
// X axis tweeks:
$g->set_x_labels( array( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
//$g->set_x_labels( array( 'Admin,Buyer,dead,Seller,Super') );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
if($y_max<$y_max1)
{
if($y_max22<$y_max1){
$a=$y_max1;
}else{
$a=$y_max22;
}
}
else
{
if($y_max22<$y_max){
$a=$y_max;
}else{
$a=$y_max22;
}
}
$g->set_y_max( $a );
$g->y_label_steps( 5 );
$g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
$g->set_bg_colour('0xFFFFFF');
$output .=$g->render();
//===================================Second Chart Starting===================================
$output .="
";
//================Rtack Upload Per Month======================================================
/* $sql="SELECT COUNT(nid) as count,MONTH(FROM_UNIXTIME(created )) AS month,created, type FROM node WHERE DATE(FROM_UNIXTIME(created)) >= DATE_sub(CURDATE(), interval 1 YEAR) AND TYPE = 'audio' GROUP BY month";
$res = mysql_query($sql);
while ($rec = mysql_fetch_array($res))
{
$rec['count'];
for($i=1;$i<=12;$i++)
{
if($i==$rec['month'])
{
$arr_month[$rec['month']] = $rec['count'];
}
else if($arr_month[$i]=='')
{
$arr_month[$i] = 0;
}
}
}
$g = new open_flash_chart_api();
$g->set_title( 'Tracks per month', '{font-size: 20px;}' );
$g->set_width(600);
$g->set_height(350);
//
// BAR CHART:
//
if(isset($arr_month))
{
$g->set_data( $arr_month );
}
// $g->bar (100, '#9933CC', '#8010A0', 'Page views', 20 );
$g->line (2, '#980065', 'Page views', 10 );
//
// ------------------------
//
//
// X axis tweeks:
//
$g->set_x_labels( array( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
$g->set_y_max( 300 );
$g->y_label_steps( 2 );
// $g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
$g->set_y_legend( 'Open Flash Chart', 12, '#4E434B' );
// $g->set_bg_colour('0xDFFFDF');
$g->set_bg_colour('0xFFFFFF');
$output .=$g->render(); */
//=================100% for artists sales per store - START====================================5Sep
//change on 10Jan2013
//referral earnings
/* $r_list = mysql_query("SELECT distinct rs.referral_uid from referralvalue_stats rs where not exists (SELECT us.uid from user_stats us where us.uid=rs.referral_uid)");
while($r_list_qry =mysql_fetch_array($r_list))
{
$ruid [] = $r_list_qry ['referral_uid'];
}
$ruids = implode(',',$ruid); */
//////////////sales for artist
if(isset($selt_yr))
{
// $sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
// $sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
// $sql_hun="select sum(tbl.sum) as sum , tbl.month from (SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month) as tbl group by month ORDER by month";
$k =0;
for($j=1;$j<=12;$j++)
{
$earnings_value=@mysql_query("select IF(sum(us.dollar_earnings) IS NULL, '0', sum(us.dollar_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." AND ud.main_dis_option='free' AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_hun=@mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_hun['month'];
$summ = $rec_hun['sum'];
if($summ=''){
$a=$j;
$arrf_month_hun[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array10[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arrf_month_hun[$rec_hun['month']] = $rec_hun['sum'];
if($rec_hun['month'] ==1){
$rec_hun['month'] = 'JAN';
}else if($rec_hun['month'] ==2){
$rec_hun['month'] = 'FEB';
}else if($rec_hun['month'] ==3){
$rec_hun['month'] = 'MAR';
}else if($rec_hun['month'] ==4){
$rec_hun['month'] = 'APR';
}else if($rec_hun['month'] ==5){
$rec_hun['month'] = 'MAY';
}else if($rec_hun['month'] ==6){
$rec_hun['month'] = 'JUN';
}else if($rec_hun['month'] ==7){
$rec_hun['month'] = 'JUL';
}else if($rec_hun['month'] ==8){
$rec_hun['month'] = 'AUG';
}else if($rec_hun['month'] ==9){
$rec_hun['month'] = 'SEP';
}else if($rec_hun['month'] ==10){
$rec_hun['month'] = 'OCT';
}else if($rec_hun['month'] ==11){
$rec_hun['month'] = 'NOV';
}else if($rec_hun['month'] ==12){
$rec_hun['month'] = 'DEC';
}
$new_array10[$k]=array( array('v' => $j,'f' => $rec_hun['month']),floatval($rec_hun['sum']));
}
$k++;
}
}
else
{
//$sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='XboxMusic' or name='iTunes Match' or name='Googleplay_streamssales' or name='Rdio' or name='youtube' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_hun="select sum(tbl.sum) as sum , tbl.month from (SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(us.dollar_earnings) IS NULL, '0', sum(us.dollar_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on ud.upcid=a.upc left join user_stats us on us.nid=a.nid where year=year(curdate()) AND month=".$j." AND ud.main_dis_option='free' AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_hun = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_hun['month'];
$summ = $rec_hun['sum'];
if($summ=''){
$a=$j;
$arrf_month_hun[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array10[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arrf_month_hun[$rec_hun['month']] = $rec_hun['sum'];
if($rec_hun['month'] ==1){
$rec_hun['month'] = 'JAN';
}else if($rec_hun['month'] ==2){
$rec_hun['month'] = 'FEB';
}else if($rec_hun['month'] ==3){
$rec_hun['month'] = 'MAR';
}else if($rec_hun['month'] ==4){
$rec_hun['month'] = 'APR';
}else if($rec_hun['month'] ==5){
$rec_hun['month'] = 'MAY';
}else if($rec_hun['month'] ==6){
$rec_hun['month'] = 'JUN';
}else if($rec_hun['month'] ==7){
$rec_hun['month'] = 'JUL';
}else if($rec_hun['month'] ==8){
$rec_hun['month'] = 'AUG';
}else if($rec_hun['month'] ==9){
$rec_hun['month'] = 'SEP';
}else if($rec_hun['month'] ==10){
$rec_hun['month'] = 'OCT';
}else if($rec_hun['month'] ==11){
$rec_hun['month'] = 'NOV';
}else if($rec_hun['month'] ==12){
$rec_hun['month'] = 'DEC';
}
$new_array10[$k]=array( array('v' => $j,'f' => $rec_hun['month']),floatval($rec_hun['sum']));
}
$k++;
//$arr_month_hun[$j] = $rec_hun['sum'];
}
}
/* $res_hun = mysql_query($sql_hun);
$num_hun = mysql_num_rows($res_hun);
if($num_hun!=0)
{
while ($rec_hun = mysql_fetch_array($res_hun))
{
for($i=1;$i<=12;$i++)
{
if($i==$rec_hun['month'])
{
$arr_month_hun[$rec_hun['month']] = $rec_hun['sum'];
}
else if($arr_month_hun[$i]=='')
{
$arr_month_hun[$i] = 0;
}
}
} */
$y_max_hun = max($arrf_month_hun)+50;
//}
//change on 10Jan2013
if(isset($selt_yr))
{
//$sql_ten="SELECT month,sum(routenote_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon'or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(round(routenote_earnings, 2)) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month)as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(round(us.routenote_earnings, 2)) IS NULL, '0', sum(round(us.routenote_earnings, 2))) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." AND ud.main_dis_option='free' AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_ten = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten['month'];
$summ = $rec_ten['sum'];
if($summ=''){
$a=$j;
$arrf_month_ten[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array11[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arrf_month_ten[$rec_ten['month']] = $rec_ten['sum'];
if($rec_ten['month'] ==1){
$rec_ten['month'] = 'JAN';
}else if($rec_ten['month'] ==2){
$rec_ten['month'] = 'FEB';
}else if($rec_ten['month'] ==3){
$rec_ten['month'] = 'MAR';
}else if($rec_ten['month'] ==4){
$rec_ten['month'] = 'APR';
}else if($rec_ten['month'] ==5){
$rec_ten['month'] = 'MAY';
}else if($rec_ten['month'] ==6){
$rec_ten['month'] = 'JUN';
}else if($rec_ten['month'] ==7){
$rec_ten['month'] = 'JUL';
}else if($rec_ten['month'] ==8){
$rec_ten['month'] = 'AUG';
}else if($rec_ten['month'] ==9){
$rec_ten['month'] = 'SEP';
}else if($rec_ten['month'] ==10){
$rec_ten['month'] = 'OCT';
}else if($rec_ten['month'] ==11){
$rec_ten['month'] = 'NOV';
}else if($rec_ten['month'] ==12){
$rec_ten['month'] = 'DEC';
}
$new_array11[$k]=array( array('v' => $j,'f' => $rec_ten['month']),floatval($rec_ten['sum']));
}
$k++;
}
}
else
{
//$sql_ten="SELECT month,sum(routenote_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon'or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(round(routenote_earnings, 2)) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month)as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(round(us.routenote_earnings, 2)) IS NULL, '0', sum(round(us.routenote_earnings, 2))) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." AND ud.main_dis_option='free' AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_ten = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten['month'];
$summ = $rec_ten['sum'];
if($summ=''){
$a=$j;
$arrf_month_ten[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array11[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arrf_month_ten[$rec_ten['month']] = $rec_ten['sum'];
if($rec_ten['month'] ==1){
$rec_ten['month'] = 'JAN';
}else if($rec_ten['month'] ==2){
$rec_ten['month'] = 'FEB';
}else if($rec_ten['month'] ==3){
$rec_ten['month'] = 'MAR';
}else if($rec_ten['month'] ==4){
$rec_ten['month'] = 'APR';
}else if($rec_ten['month'] ==5){
$rec_ten['month'] = 'MAY';
}else if($rec_ten['month'] ==6){
$rec_ten['month'] = 'JUN';
}else if($rec_ten['month'] ==7){
$rec_ten['month'] = 'JUL';
}else if($rec_ten['month'] ==8){
$rec_ten['month'] = 'AUG';
}else if($rec_ten['month'] ==9){
$rec_ten['month'] = 'SEP';
}else if($rec_ten['month'] ==10){
$rec_ten['month'] = 'OCT';
}else if($rec_ten['month'] ==11){
$rec_ten['month'] = 'NOV';
}else if($rec_ten['month'] ==12){
$rec_ten['month'] = 'DEC';
}
$new_array11[$k]=array( array('v' => $j,'f' => $rec_ten['month']),floatval($rec_ten['sum']));
}
$k++;
}
}
/* $res_ten = mysql_query($sql_ten);
$num_ten = mysql_num_rows($res_ten) */;
/* if($num_ten!=0)
{
while ($rec_ten = mysql_fetch_array($res_ten))
{
for($i=1;$i<=12;$i++)
{
if($i==$rec_ten['month'])
{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
}
else if($arr_month_ten[$i]=='')
{
$arr_month_ten[$i] = 0;
}
}
} */
$y_max_ten = max($arrf_month_ten)+50;
//}
if(isset($selt_yr))
{
// $sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
// $sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
// $sql_hun="select sum(tbl.sum) as sum , tbl.month from (SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value123=@mysql_query("select IF(sum(us.dollar_earnings) IS NULL, '0', sum(us.dollar_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." AND ud.main_dis_option!='free' AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_hun23=@mysql_fetch_array($earnings_value123);
//$listrad['earn'] = 1;
$mn = $rec_hun23['month'];
$summ = $rec_hun23['sum'];
if($summ=''){
$a=$j;
$arr_month123_hunaa[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array12[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month123_hunaa[$j] = $rec_hun23['sum'];
if($rec_hun23['month'] ==1){
$rec_hun23['month'] = 'JAN';
}else if($rec_hun23['month'] ==2){
$rec_hun23['month'] = 'FEB';
}else if($rec_hun23['month'] ==3){
$rec_hun23['month'] = 'MAR';
}else if($rec_hun23['month'] ==4){
$rec_hun23['month'] = 'APR';
}else if($rec_hun23['month'] ==5){
$rec_hun23['month'] = 'MAY';
}else if($rec_hun23['month'] ==6){
$rec_hun23['month'] = 'JUN';
}else if($rec_hun23['month'] ==7){
$rec_hun23['month'] = 'JUL';
}else if($rec_hun23['month'] ==8){
$rec_hun23['month'] = 'AUG';
}else if($rec_hun23['month'] ==9){
$rec_hun23['month'] = 'SEP';
}else if($rec_hun23['month'] ==10){
$rec_hun23['month'] = 'OCT';
}else if($rec_hun23['month'] ==11){
$rec_hun23['month'] = 'NOV';
}else if($rec_hun23['month'] ==12){
$rec_hun23['month'] = 'DEC';
}
$new_array12[$k]=array( array('v' => $j,'f' => $rec_hun23['month']),floatval($rec_hun23['sum']));
}
$k++;
}
}
else
{
//$sql_hun="SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='XboxMusic' or name='iTunes Match' or name='Googleplay_streamssales' or name='Rdio' or name='youtube' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_hun="select sum(tbl.sum) as sum , tbl.month from (SELECT month,sum(dollar_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(us.dollar_earnings) IS NULL, '0', sum(us.dollar_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." AND ud.main_dis_option!='free' AND us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_hun23 = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_hun23['month'];
$summ = $rec_hun23['sum'];
if($summ=''){
$arr_month123_teneww[$j] = 0;
$a=$j;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array13[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month123_teneww[$rec_ten234['month']] = $rec_ten234['sum'];
if($rec_ten234['month'] ==1){
$rec_ten234['month'] = 'JAN';
}else if($rec_ten234['month'] ==2){
$rec_ten234['month'] = 'FEB';
}else if($rec_ten234['month'] ==3){
$rec_ten234['month'] = 'MAR';
}else if($rec_ten234['month'] ==4){
$rec_ten234['month'] = 'APR';
}else if($rec_ten234['month'] ==5){
$rec_ten234['month'] = 'MAY';
}else if($rec_ten234['month'] ==6){
$rec_ten234['month'] = 'JUN';
}else if($rec_ten234['month'] ==7){
$rec_ten234['month'] = 'JUL';
}else if($rec_ten234['month'] ==8){
$rec_ten234['month'] = 'AUG';
}else if($rec_ten234['month'] ==9){
$rec_ten234['month'] = 'SEP';
}else if($rec_ten234['month'] ==10){
$rec_ten234['month'] = 'OCT';
}else if($rec_ten234['month'] ==11){
$rec_ten234['month'] = 'NOV';
}else if($rec_ten234['month'] ==12){
$rec_ten234['month'] = 'DEC';
}
$new_array13[$k]=array( array('v' => $j,'f' => $rec_ten234['month']),floatval($rec_ten234['sum']));
}
$k++;
}
}
$y_max_hunee = max($arr_month123_hunaa)+50;
if(isset($selt_yr))
{
//$sql_ten="SELECT month,sum(routenote_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon'or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(round(routenote_earnings, 2)) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month)as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(round(us.routenote_earnings, 2)) IS NULL, '0', sum(round(us.routenote_earnings, 2))) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." and ud.main_dis_option!='free' and us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_ten234 = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten234['month'];
$summ = $rec_ten234['sum'];
if($summ=''){
$arr_month123_teneww[$j] = 0;
$a=$j;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array13[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
//$arr_month123_teneww[$rec_ten234['month']] = $rec_ten234['sum'];
$arr_month123_teneww[$j] = $rec_ten234['sum'];
if($rec_ten234['month'] ==1){
$rec_ten234['month'] = 'JAN';
}else if($rec_ten234['month'] ==2){
$rec_ten234['month'] = 'FEB';
}else if($rec_ten234['month'] ==3){
$rec_ten234['month'] = 'MAR';
}else if($rec_ten234['month'] ==4){
$rec_ten234['month'] = 'APR';
}else if($rec_ten234['month'] ==5){
$rec_ten234['month'] = 'MAY';
}else if($rec_ten234['month'] ==6){
$rec_ten234['month'] = 'JUN';
}else if($rec_ten234['month'] ==7){
$rec_ten234['month'] = 'JUL';
}else if($rec_ten234['month'] ==8){
$rec_ten234['month'] = 'AUG';
}else if($rec_ten234['month'] ==9){
$rec_ten234['month'] = 'SEP';
}else if($rec_ten234['month'] ==10){
$rec_ten234['month'] = 'OCT';
}else if($rec_ten234['month'] ==11){
$rec_ten234['month'] = 'NOV';
}else if($rec_ten234['month'] ==12){
$rec_ten234['month'] = 'DEC';
}
$new_array13[$k]=array( array('v' => $j,'f' => $rec_ten234['month']),floatval($rec_ten234['sum']));
}
$k++;
}
}
else
{
//$sql_ten="SELECT month,sum(routenote_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon'or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(round(routenote_earnings, 2)) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month)as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("select IF(sum(round(us.routenote_earnings, 2)) IS NULL, '0', sum(round(us.routenote_earnings, 2))) as sum, IF(us.month IS NULL, '0', us.month) as month from upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." and ud.main_dis_option!='free' and us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')");
$rec_ten234 = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten234['month'];
$summ = $rec_ten234['sum'];
if($summ=''){
$arr_month123_teneww[$j] = 0;
$a=$j;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array13[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
//$arr_month123_teneww[$rec_ten234['month']] = $rec_ten234['sum'];
$arr_month123_teneww[$j] = $rec_ten234['sum'];
if($rec_ten234['month'] ==1){
$rec_ten234['month'] = 'JAN';
}else if($rec_ten234['month'] ==2){
$rec_ten234['month'] = 'FEB';
}else if($rec_ten234['month'] ==3){
$rec_ten234['month'] = 'MAR';
}else if($rec_ten234['month'] ==4){
$rec_ten234['month'] = 'APR';
}else if($rec_ten234['month'] ==5){
$rec_ten234['month'] = 'MAY';
}else if($rec_ten234['month'] ==6){
$rec_ten234['month'] = 'JUN';
}else if($rec_ten234['month'] ==7){
$rec_ten234['month'] = 'JUL';
}else if($rec_ten234['month'] ==8){
$rec_ten234['month'] = 'AUG';
}else if($rec_ten234['month'] ==9){
$rec_ten234['month'] = 'SEP';
}else if($rec_ten234['month'] ==10){
$rec_ten234['month'] = 'OCT';
}else if($rec_ten234['month'] ==11){
$rec_ten234['month'] = 'NOV';
}else if($rec_ten234['month'] ==12){
$rec_ten234['month'] = 'DEC';
}
$new_array13[$k]=array( array('v' => $j,'f' => $rec_ten234['month']),floatval($rec_ten234['sum']));
}
$k++;
}
}
if(isset($new_array11)){
if(count($new_array11)>0){
for($i=0;$i0){
for($i=0;$i0){
for($i=0;$i
';
$output .="
";
$g = new open_flash_chart_api();
$g->set_title( 'TOTAL DOLLAR SALES FOR ARTISTS ', '{font-size: 20px;}' );
$g->set_width(600);
$g->set_height(350);
//
// BAR CHART:
//
if(isset($arrf_month_hun))
{
$g->set_data( $arrf_month_hun );
$g->line (2, '#980065', 'Free Total artist sales', 10 );
}
if(isset($arrf_month_ten))
{
$g->set_data( $arrf_month_ten );
$g->line_dot (2,4, '#4E434B', 'Free Cut amount of artist sales', 10 );
}
if(isset($arr_month123_hunaa))
{
$g->set_data( $arr_month123_hunaa );
$g->line (2, '#3498DB', 'Premium Total artist sales', 10 );
}
if(isset($arr_month123_teneww))
{
$g->set_data( $arr_month123_teneww );
$g->line_dot (2,4, '#2ECC71', 'Premium Cut amount of artist sales', 10 );
}
// $g->bar (100, '#9933CC', '#8010A0', 'Page views', 20 );
//
// ------------------------
//
//
// X axis tweeks:
//
$g->set_x_labels( array( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
if(isset($y_max_artolsat))
{
$a=$y_max_artolsat;
}
$g->set_y_max( $a );
$g->y_label_steps( 2 );
// $g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
$g->set_y_legend( 'Open Flash Chart', 12, '#4E434B' );
// $g->set_bg_colour('0xDFFFDF');
$g->set_bg_colour('0xFFFFFF');
$output .=$g->render();
$output .="
";
//=================100% for artists sales per store - END ====================5Sep
//= =============== artists sale - START ====================5Sep
//change on 10Jan2013
if(isset($selt_yr))
{
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month UNION SELECT month,sum(referral_earnings) as sum FROM referralvalue_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("SELECT tbl.month,sum(tbl.sum) as sum from (SELECT IF(sum(us.artist_earnings) IS NULL, '0', sum(us.artist_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." and ud.main_dis_option='free' and us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG') UNION SELECT IF(sum(us.referral_earnings) IS NULL, '0', sum(us.referral_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join referralvalue_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." and ud.main_dis_option='free' and us.name in ('iTunes','iTunes_radio','Apple Music' ,'eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')) as tbl");
$rec_ten = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten['month'];
$summ = $rec_ten['sum'];
if($summ=''){
$a=$j;
$arr_month_ten[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array4[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
//$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
if($rec_ten['month'] ==1){
$rec_ten['month'] = 'JAN';
}else if($rec_ten['month'] ==2){
$rec_ten['month'] = 'FEB';
}else if($rec_ten['month'] ==3){
$rec_ten['month'] = 'MAR';
}else if($rec_ten['month'] ==4){
$rec_ten['month'] = 'APR';
}else if($rec_ten['month'] ==5){
$rec_ten['month'] = 'MAY';
}else if($rec_ten['month'] ==6){
$rec_ten['month'] = 'JUN';
}else if($rec_ten['month'] ==7){
$rec_ten['month'] = 'JUL';
}else if($rec_ten['month'] ==8){
$rec_ten['month'] = 'AUG';
}else if($rec_ten['month'] ==9){
$rec_ten['month'] = 'SEP';
}else if($rec_ten['month'] ==10){
$rec_ten['month'] = 'OCT';
}else if($rec_ten['month'] ==11){
$rec_ten['month'] = 'NOV';
}else if($rec_ten['month'] ==12){
$rec_ten['month'] = 'DEC';
}
$new_array4[$k]=array( array('v' => $j,'f' => $rec_ten['month']),floatval($rec_ten['sum']));
}
$k++;
}
}
else
{
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month UNION SELECT month,sum(referral_earnings) as sum FROM referralvalue_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_value = @mysql_query("SELECT tbl.month,sum(tbl.sum) as sum from (SELECT IF(sum(us.artist_earnings) IS NULL, '0', sum(us.artist_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." and ud.main_dis_option='free' and us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG') UNION SELECT IF(sum(us.referral_earnings) IS NULL, '0', sum(us.referral_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join referralvalue_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." and ud.main_dis_option='free' and us.name in ('iTunes','iTunes_radio','Apple Music' ,'eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')) as tbl");
$rec_ten = @mysql_fetch_array($earnings_value);
//$listrad['earn'] = 1;
$mn = $rec_ten['month'];
$summ = $rec_ten['sum'];
if($summ=''){
$a=$j;
$arr_month_ten[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array4[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
//$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
if($rec_ten['month'] ==1){
$rec_ten['month'] = 'JAN';
}else if($rec_ten['month'] ==2){
$rec_ten['month'] = 'FEB';
}else if($rec_ten['month'] ==3){
$rec_ten['month'] = 'MAR';
}else if($rec_ten['month'] ==4){
$rec_ten['month'] = 'APR';
}else if($rec_ten['month'] ==5){
$rec_ten['month'] = 'MAY';
}else if($rec_ten['month'] ==6){
$rec_ten['month'] = 'JUN';
}else if($rec_ten['month'] ==7){
$rec_ten['month'] = 'JUL';
}else if($rec_ten['month'] ==8){
$rec_ten['month'] = 'AUG';
}else if($rec_ten['month'] ==9){
$rec_ten['month'] = 'SEP';
}else if($rec_ten['month'] ==10){
$rec_ten['month'] = 'OCT';
}else if($rec_ten['month'] ==11){
$rec_ten['month'] = 'NOV';
}else if($rec_ten['month'] ==12){
$rec_ten['month'] = 'DEC';
}
$new_array4[$k]=array( array('v' => $j,'f' => $rec_ten['month']),floatval($rec_ten['sum']));
}
$k++;
}
}
/* $res_ten = mysql_query($sql_ten);
$num_ten = mysql_num_rows($res_ten);
*/
/* if($num_ten!=0)
{
while ($rec_ten = mysql_fetch_array($res_ten))
{
for($i=1;$i<=12;$i++)
{
if($i==$rec_ten['month'])
{
$arr_month_ten[$rec_ten['month']] = $rec_ten['sum'];
}
else if($arr_month_ten[$i]=='')
{
$arr_month_ten[$i] = 0;
}
}
} */
$y_max_ten = max($arr_month_ten)+50;
if(isset($selt_yr))
{
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year='$selt_yr' group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month UNION SELECT month,sum(referral_earnings) as sum FROM referralvalue_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=$selt_yr group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_valuefd = @mysql_query("SELECT tbl.month,sum(tbl.sum) as sum from (SELECT IF(sum(us.artist_earnings) IS NULL, '0', sum(us.artist_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." and ud.main_dis_option!='free' and us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG') UNION SELECT IF(sum(us.referral_earnings) IS NULL, '0', sum(us.referral_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join referralvalue_stats us on us.nid=a.nid where us.year=".$selt_yr." AND us.month=".$j." and ud.main_dis_option!='free' and us.name in ('iTunes','iTunes_radio','Apple Music' ,'eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')) as tbl");
$rec_ten234vv = @mysql_fetch_array($earnings_valuefd);
//$listrad['earn'] = 1;
$mn = $rec_ten234vv['month'];
$summ = $rec_ten234vv['sum'];
if($summ=''){
$a=$j;
$arr_month123_teneww[$j] = 0;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array5[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month123_teneww[$rec_ten234vv['month']] = $rec_ten234vv['sum'];
if($rec_ten234vv['month'] ==1){
$rec_ten234vv['month'] = 'JAN';
}else if($rec_ten234vv['month'] ==2){
$rec_ten234vv['month'] = 'FEB';
}else if($rec_ten234vv['month'] ==3){
$rec_ten234vv['month'] = 'MAR';
}else if($rec_ten234vv['month'] ==4){
$rec_ten234vv['month'] = 'APR';
}else if($rec_ten234vv['month'] ==5){
$rec_ten234vv['month'] = 'MAY';
}else if($rec_ten234vv['month'] ==6){
$rec_ten234vv['month'] = 'JUN';
}else if($rec_ten234vv['month'] ==7){
$rec_ten234vv['month'] = 'JUL';
}else if($rec_ten234vv['month'] ==8){
$rec_ten234vv['month'] = 'AUG';
}else if($rec_ten234vv['month'] ==9){
$rec_ten234vv['month'] = 'SEP';
}else if($rec_ten234vv['month'] ==10){
$rec_ten234vv['month'] = 'OCT';
}else if($rec_ten234vv['month'] ==11){
$rec_ten234vv['month'] = 'NOV';
}else if($rec_ten234vv['month'] ==12){
$rec_ten234vv['month'] = 'DEC';
}
$new_array5[$k]=array( array('v' => $j,'f' => $rec_ten234vv['month']),floatval($rec_ten234vv['sum']));
}
$k++;
}
}
else
{
//$sql_ten="SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='Deezer' or name='eMUSIC' or name='Amazon' or name='Spotify' or name='Spotify Downloads' or name='iTunes Match' or name='youtube' or name='Xbox' or name='XboxMusic' or name='Googleplay_streamssales' or name='Rdio' or name='Googleplay_lockersales' or name='Googleplay' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month ORDER by month";
//$sql_ten="SELECT tbl.month,sum(tbl.sum) as sum from (SELECT month,sum(artist_earnings) as sum FROM user_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Deezer' or name='youtube' or name='Xbox' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month UNION SELECT month,sum(referral_earnings) as sum FROM referralvalue_stats where (name='iTunes' or name='eMUSIC' or name='Amazon' or name='RouteNote' or name='Spotify' or name='Spotify Downloads' or name='Xbox' or name='Deezer' or name='youtube' or name='Googleplay' or name='Googleplay_streamssales' or name='Xboxmusic' or name='Rdio' or name='routenotedirect' or name='WiMP' or name='iTunes Match' or name='Sony Music Unlimited' or name='SoundCloud') and year=year(curdate()) group by month) as tbl group by month ORDER by month";
$k=0;
for($j=1;$j<=12;$j++)
{
$earnings_valuesd33 = @mysql_query("SELECT tbl.month,sum(tbl.sum) as sum from (SELECT IF(sum(us.artist_earnings) IS NULL, '0', sum(us.artist_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join user_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." and ud.main_dis_option!='free' and us.name in ('iTunes','iTunes_radio','Apple Music','eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG') UNION SELECT IF(sum(us.referral_earnings) IS NULL, '0', sum(us.referral_earnings)) as sum, IF(us.month IS NULL, '0', us.month) as month FROM upc_distribution ud left join audio a on a.upc=ud.upcid left join referralvalue_stats us on us.nid=a.nid where us.year=year(curdate()) AND us.month=".$j." and ud.main_dis_option!='free' and us.name in ('iTunes','iTunes_radio','Apple Music' ,'eMUSIC','Amazon', 'RouteNote', 'Spotify', 'Spotify Downloads', 'Deezer', 'youtube', 'YouTube Music Key', 'Xbox', 'Googleplay', 'Googleplay_streamssales', 'Xboxmusic', 'Rdio', 'routenotedirect', 'WiMP', 'wimp_download', 'iTunes Match', 'Sony Music Unlimited', 'SoundCloud','Mix_Radio','iTunes Beats Radio','amazon_prime','247 Ent','Anghami','YouTube RED','Pandora','Amazon Music Unlimited','Kanjian','Claro-musica','Napster','Melon Downloads','Melon Streams','Bugs!','Amazon Music Unlimited B','AmazonprimeB','Googleplay_lockersales','YT RED','Saavn','YT Sync','iHeart Radio','netease_download','netease_streams','7Digital','24-7Legacy','24-7Juke','nuuday','Facebook','tencent','tencentlive','AWA','yt_sync_red_adj','yt-adj','yt_cm_adj','synchedin','yt_syn-red-adj_video','Tidal','Tidal_download','Resso','iTunes_DJ_MIX','TikTok','YG')) as tbl");
$rec_ten234vv = @mysql_fetch_array($earnings_valuesd33);
//$listrad['earn'] = 1;
$mn = $rec_ten234vv['month'];
$summ = $rec_ten234vv['sum'];
if($summ=''){
$arr_month123_teneww[$j] = 0;
$a=$j;
if($a ==1){
$a = 'JAN';
}else if($a ==2){
$a = 'FEB';
}else if($a ==3){
$a = 'MAR';
}else if($a ==4){
$a = 'APR';
}else if($a ==5){
$a = 'MAY';
}else if($a ==6){
$a = 'JUN';
}else if($a ==7){
$a = 'JUL';
}else if($a ==8){
$a = 'AUG';
}else if($a ==9){
$a = 'SEP';
}else if($a ==10){
$a = 'OCT';
}else if($a ==11){
$a = 'NOV';
}else if($a ==12){
$a = 'DEC';
}
$new_array5[$k]=array( array('v' => $j,'f' => $a),floatval(0));
}
else{
$arr_month123_teneww[$rec_ten234vv['month']] = $rec_ten234vv['sum'];
if($rec_ten234vv['month'] ==1){
$rec_ten234vv['month'] = 'JAN';
}else if($rec_ten234vv['month'] ==2){
$rec_ten234vv['month'] = 'FEB';
}else if($rec_ten234vv['month'] ==3){
$rec_ten234vv['month'] = 'MAR';
}else if($rec_ten234vv['month'] ==4){
$rec_ten234vv['month'] = 'APR';
}else if($rec_ten234vv['month'] ==5){
$rec_ten234vv['month'] = 'MAY';
}else if($rec_ten234vv['month'] ==6){
$rec_ten234vv['month'] = 'JUN';
}else if($rec_ten234vv['month'] ==7){
$rec_ten234vv['month'] = 'JUL';
}else if($rec_ten234vv['month'] ==8){
$rec_ten234vv['month'] = 'AUG';
}else if($rec_ten234vv['month'] ==9){
$rec_ten234vv['month'] = 'SEP';
}else if($rec_ten234vv['month'] ==10){
$rec_ten234vv['month'] = 'OCT';
}else if($rec_ten234vv['month'] ==11){
$rec_ten234vv['month'] = 'NOV';
}else if($rec_ten234vv['month'] ==12){
$rec_ten234vv['month'] = 'DEC';
}
$new_array5[$k]=array( array('v' => $j,'f' => $rec_ten234vv['month']),floatval($rec_ten234vv['sum']));
}
$k++;
}
}
//}
if(isset($new_array5)){
if(count($new_array5)>0){
for($i=0;$i
';
$output .="
";
$g = new open_flash_chart_api();
$g->set_title( 'Artist Payout Per Month', '{font-size: 20px;}' );
$g->set_width(600);
$g->set_height(350);
//
// BAR CHART:
//
if(isset($arr_month_ten))
{
$g->set_data( $arr_month_ten );
}
// $g->bar (100, '#9933CC', '#8010A0', 'Page views', 20 );
$g->line (2, '#980065', 'Free Artist Payout', 10 );
if(isset($arr_month123_teneww))
{
$g->set_data( $arr_month123_teneww );
}
// $g->bar (100, '#9933CC', '#8010A0', 'Page views', 20 );
$g->line (2, '#3498DB', 'Premium Artist Payout', 10 );
//
// ------------------------
//
//
// X axis tweeks:
//
$g->set_x_labels( array( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
if(isset($y_max_ten))
{
$a=$y_max_ten;
}
$g->set_y_max( $a );
$g->y_label_steps( 2 );
// $g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
$g->set_y_legend( 'Open Flash Chart', 12, '#4E434B' );
// $g->set_bg_colour('0xDFFFDF');
$g->set_bg_colour('0xFFFFFF');
$output .=$g->render();
return $output;
}
function homepage() {
global $base_url;
$output = "
| The Digital Distribution Solution |
RouteNote - Online licensing and distribution made simple |
License - Unique Music for creative producers Instant access to the online market - - Distribute |
|
|
";
// $output.=drupal_get_form('user_login_block');
$output.= " |
|
| Artist / Label Distribution |
";
$tid_sel = db_fetch_array(db_query("SELECT * FROM term_data WHERE name = 'Artist'"));
$service_node_qry = db_query("SELECT nr.title,nr.body,nr.nid FROM node_revisions nr WHERE nr.nid in (SELECT tn.nid FROM term_node tn WHERE tn.tid = '".$tid_sel['tid']."' ) limit 0,4");
while($nid_data = db_fetch_array($service_node_qry)) {
$link = $base_url."/node/".$nid_data['nid'];
$output .= "".$nid_data['title']."";
$output .= " ".substr($nid_data['body'],0,42)."... | | ";
}
$output .= " | | | | Licensing Music | ";
$tid_sel = db_fetch_array(db_query("SELECT * FROM term_data WHERE name = 'Licensee'"));
$service_node_qry = db_query("SELECT nr.title,nr.body,nr.nid FROM node_revisions nr WHERE nr.nid in (SELECT tn.nid FROM term_node tn WHERE tn.tid = '".$tid_sel['tid']."')limit 0,4");
while($nid_data = db_fetch_array($service_node_qry)) {
$link = $base_url."/node/".$nid_data['nid'];
$output .= "".$nid_data['title']."";
$output .= " ".substr($nid_data['body'],0,42)."... | | ";
}
$output .= " |
| | | | ";
return $output;
}
function artists_list(){
global $user;
$output = '
';
$output .= theme('pager', NULL,50,0);
return $output;
}
function all_artist_statistics(){
$usid = arg(2);
// $title = arg(3);
// $nid = arg(4);
$qry ="SELECT * FROM user_stats where usid='".$usid."'";
// $qry ="SELECT * FROM user_stats where uid=".$uid." AND title='".$title."'";
$sql1 = db_query($qry);
$rec = db_fetch_object($sql1);
// echo $rec->name;
// echo $rec->title;
$sql = db_query("SELECT * FROM route_distributors ORDER BY did ASC");
$options= array();
while($result = db_fetch_object($sql)){
$options[] = $result->name;
}
/* $form['retailers'] = array(
'#type'=>'select',
'#title'=>t('Retailer'),
'#default_value'=> $rec->name,
'#options'=>$options,
);
*/
$form['retailers'] = array(
'#type'=>'textfield',
'#title'=>t('Retailer'),
'#default_value'=> $rec->name,
);
$query = db_query("SELECT * FROM node WHERE type='audio' AND uid = ".$usid);
$tracks = array();
while($audio = db_fetch_object($query)){
$tracks[] = $audio->title;
}
if($rec->album=='0')
{
$form['song'] = array(
'#type'=>'textfield',
'#title'=>t('Song'),
'#default_value'=> $rec->title,
);
}
else{
$form['album'] = array(
'#type'=>'textfield',
'#title'=>t('Album'),
'#default_value'=> $rec->album,
);
}
// $query = db_query("SELECT * FROM user_stats WHERE uid = ".$uid);
// $rec = db_fetch_object($query);
//$options1 = array('Jan'=> 'Jan','Feb'=> 'Feb','March'=>'March','April'=>'April','May' =>'May','June'=>'June','July'=>'July','Aug'=>'Aug','Sep'=>'Sep','Oct'=>'Oct','Nov'=>'Nov','Dec'=>'Dec');
$options1[0] = '';
$options1 = array('1'=> 'Jan','2'=> 'Feb','3'=>'March','4'=>'April','5' =>'May','6'=>'June','7'=>'July','8'=>'Aug','9'=>'Sep','10'=>'Oct','11'=>'Nov','12'=>'Dec');
$form['month'] = array(
'#type'=>'select',
'#prefix' =>' | ',
'#title'=>t('Month'),
'#options'=>$options1,
'#default_value'=>$rec->month,
'#suffix' =>' | ',
);
$options2[0] = '';
$options2 = array('2007'=> '2007','2008'=> '2008', '2009'=> '2009','2010'=> '2010','2011'=> '2011','2012'=> '2012');
$form['year'] = array(
'#type'=>'select',
'#prefix' => '',
'#title'=>t('Year'),
'#options'=>$options2,
'#default_value'=>$rec->year,
'#suffix' => ' |
',
);
$form['downloads'] = array(
'#type'=>'textfield',
'#title'=>t('Downloads'),
'#default_value'=>$rec->downloads,
);
/*$form['downloads_per_store'] = array(
'#type'=>'textfield',
'#title'=>t('Downloads Per Store'),
);*/
$form['streams'] = array(
'#type'=>'textfield',
'#title'=>t('Streams'),
'#default_value'=>$rec->streams,
);
$form['earnings'] = array(
'#type'=>'textfield',
'#title'=>t('Earnings'),
'#default_value'=>$rec->artist_earnings,
);
$form['usid'] = array(
'#type'=>'hidden',
'#title'=>t(''),
'#value' =>$usid,
);
$form['statistics']=array(
'#type'=>'submit',
'#value'=>t('Update'),
);
return $form;
}
function all_artist_statistics_submit($form, &$form_state){
$usid = arg(2);
/* $sql = db_query("SELECT * FROM route_distributors ORDER BY did ASC");
$options= array();
while($result = db_fetch_object($sql)){
$options[] = $result->name;
} */
// $distributors =$options[$form_state['values']['retailers']];
/* $query = db_query("SELECT * FROM node WHERE type='audio' AND uid = ".$uid);
$tracks = array();
$nids = array();
while($audio = db_fetch_object($query)){
$tracks[] = $audio->title;
$nids[] = $audio->nid;
}*/
// $track = $tracks[$form_state['values']['song']];
$track = $form_state['values']['song'];
$distributors =$form_state['values']['retailers'];
/* $query = db_query("SELECT * FROM user_stats WHERE uid = ".$uid." AND name='".$distributors."' AND title='".$track."'");
$rec = db_fetch_object($query);
*/
// $nid = $nids[$form_state['values']['song']];
$nid = $form_state['values']['nodeid'];
$downloads = $form_state['values']['downloads'];
//$downloads_per_store = $form_state['values']['downloads_per_store'];
$streams = $form_state['values']['streams'];
$earnings = $form_state['values']['earnings'];
$month = $form_state['values']['month'];
$year = $form_state['values']['year'];
$album = $form_state['values']['album'];
//$date = time();
// $date = $form_state['values']['dos'];
if($_POST['op']=='Update'){
// if($track) { //echo "INSERT INTO {user_stats} (uid, downloads,name, streams, earnings, date, title, nid) VALUES ($uid, $downloads, '".$distributors."', $streams, $earnings, '".$date."', '".$track."',$nid)";
//(%d, %d, '%s', %d, %d, '%s','%s',%d)", $uid, $downloads, $distributors, $streams, $earnings, $date, $track,$nid);
//march14
if($form_state['values']['album']!='')
{
$QRY = "UPDATE user_stats SET downloads=".mysql_real_escape_string($downloads).", name='".mysql_real_escape_string($distributors)."', streams='".mysql_real_escape_string($streams)."', artist_earnings='".mysql_real_escape_string($earnings)."', month='".mysql_real_escape_string($month)."',year='".mysql_real_escape_string($year)."', album='".mysql_real_escape_string(addslashes($album))."' WHERE usid=".mysql_real_escape_string($usid);
}
else
{
$QRY = "UPDATE user_stats SET downloads=".mysql_real_escape_string($downloads).", name='".mysql_real_escape_string($distributors)."', streams='".mysql_real_escape_string($streams)."', artist_earnings='".mysql_real_escape_string($earnings)."', month='".mysql_real_escape_string($month)."',year='".mysql_real_escape_string($year)."', title='".mysql_real_escape_string(addslashes($track))."' WHERE usid=".mysql_real_escape_string($usid);
}
//march14
$stats = mysql_query($QRY);
if(arg(3)!=''){
$id=arg(3);
drupal_goto("ex_sales_history/$id");
}else{
drupal_goto('all_artists');
}
// }
}
//return 'artists';
}
function band_image(){
$output = '';
$sql = db_query("SELECT * FROM `node` WHERE TYPE = 'image'");
$header = array(t('Title'), t('Operations'));
$destination = drupal_get_destination();
while($band = db_fetch_object($sql)){
$rows[]= array(
array('data'=>$band->title),
array('data'=>l(t('edit'), 'node/'. $band->nid .'/edit',array(),$destination), )
);
}
$output .= theme('table', $header, $rows);
return $output;
}
function banner_display() {
global $base_url,$user;
$role = implode(', ', array_slice($user->roles, 1));
$output = '';
$output .= ' Banner for your site';
$selectbanner = db_query("SELECT c.field_banner_text_value size, n . * , f . * , nr.body FROM node n LEFT JOIN files f ON n.nid = f.nid LEFT JOIN node_revisions nr ON n.nid = nr.nid LEFT JOIN content_type_banner c ON n.nid = c.nid WHERE n.type = 'banner'");
while($banres=db_fetch_array($selectbanner)) {
$img_path =$base_url."/".$banres['filepath'];
$info = image_get_info($banres['filepath']);
$attributess = $info['width'];
$attributess = $info['height'];
list($maxwidth, $maxheight) = explode('x', variable_get($attributess, '100x100'));
$size = $banres['size'];
$output .= '  | | ';
if($role == 'admin' || $role == 'super' ){
$output .= ''.l('edit','node/'.$banres['nid'].'/edit').' '.l('delete','node/'.$banres['nid'].'/delete').' | ';
}
$body = $banres['body'];
$result = explode("<",$body);
$img = "<".$result[1];
$source = "<".$result[2].">";
$close = "<".$result[4]." ";
$output .= ''.$img.' |
'.$source.' |
'.$close.' |
';
$output .= '
';
}
$output .= ' RNTV Single Video Widget - New Videos Every Month';
$output .= ' ';
return $output;
}
function routenote_direct_transactions_page(){
global $base_url;
drupal_add_css("css/artist_directory.css");
drupal_add_css("css/my_content.css");
global $user;
$role = implode(', ', array_slice($user->roles, 1));
$user_id=$user->uid;
$header[] = array('field' => '');
if ($role == 'admin'){
$r = "SELECT * FROM routenotedirect_downloads WHERE status='Completed' and upc!='' and transaction_id!='' group by transaction_id order by sub_album_id";
$r .= tablesort_sql($header);
$sql = pager_queryMod($r, 250, 0, NULL);
$output =' ';
$output .=" All RouteNote Download Transactions";
$output .='
';
$output .= "";
$output .="| Name of Artists | UPC | Date of Purchase | Price | Paypal transaction ID | Paypal address of Buyer | ";
while($artists_list = db_fetch_object($sql)){
$sel_art=db_query("select * from audio a join node n on a.nid=n.nid join users u on u.uid=n.uid where a.upc=".$artists_list->upc."");
$list_art=db_fetch_array($sel_art);
$output .= "| ".$list_art['name']." | ".$artists_list->upc." | ".$artists_list->subscription_date." | ".$artists_list->sub_amount." | ".$artists_list->transaction_id." | ".$artists_list->payer_email." | ";
}
}
else{
$output .="You are not authorized to access this page";
}
$output .= theme('pager', NULL,250,0);
$output .=" ";
return $output;
}
function routenote_direct_urlgeneration_page(){
global $base_url;
global $user;
$user_id=$user->uid;
drupal_add_css("css/artist_directory.css");
drupal_add_css("css/my_content.css");
$role = implode(', ', array_slice($user->roles, 1));
$header[] = array('field' => '');
if ($role == 'admin')
{
$output = '';
if($_POST['upcno']!="")
{
$output.="
Copy and Paste the below download URL,";
$output.="";
}
}
else
{
$output .="You are not authorized to access this page";
}
$output .=" |