<?php

function showshps()
{
$conn=mysqli_connect("localhost","primarysales","S5L7lF01EQZvQrGK","primarysales_diana");
if(isset($_REQUEST['starts']) && isset($_REQUEST['ends'])){
$starts=$_REQUEST['starts'];
$ends=$_REQUEST['ends'];}
else{
$starts=0;
$ends=0;

$months=date('m');
$days=date('t');
$years=date('Y');

if($starts==0 || $starts==''){
$starts=$years."-".$months."-01";}
if($ends==0 || $ends==''){
$ends=$years."-".$months."-".$days;}

$tmstarts=$years."-".($months-5)."-01";
}

printf("<div class='sides'>");

printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>Area wise reports</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='przonesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Zone summary</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prregionsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All' target='_blank'>Region summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='pragentsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All' target='_blank'>Agency summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prsalestypes.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All' target='_blank'>Sales type summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prterritorysummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Territory summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='pragentsinvoices.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Invoice summary</a></td></tr></table></div></div>",$starts,$ends);

#printf("<div class='mnm' id='itemsm' ><div class='amn' id='amnd'><b>Item wise reports</b></div>");
#printf("<div class='sbm' id='itemsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='prrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=All' target='_blank'>Range summary</a></td></tr></div>",$starts,$ends);
#printf("<tr ><td style='font-size:13'><a   href='prsubrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all' target='_blank'>Sub Range summary</a></td></tr>",$starts,$ends);
#printf("<tr ><td  style='font-size:13'><a   href='pritemsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&subranges=all' target='_blank'>Item summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='agentsm'><div class='amn' id='amnc'><b>Profiling</b></div>");
printf("<div class='sbm' id='agentsb' style='display:block'><table><tr><td width=150  style='font-size:13'><a  href='prprofs.php?rpsty=regionssummarys&starts=%s&ends=%s&sprftypes=zones&params=none' target='_blank'>Zone profiles</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='prprofs.php?rpsty=agentsitems&starts=%s&ends=%s&sprftypes=regions&params=none' target='_blank'>Region profile</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='prprofs.php?rpsty=agentsitems&starts=%s&ends=%s&sprftypes=agents&params=none' target='_blank'>Agency profile</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='prprofs.php?rpsty=agentsummarys&starts=%s&ends=%s&sprftypes=territorys&params=none' target='_blank'>Territory profile</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Team wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='prrsmsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&zones=All&regions=All' target='_blank'>RSM summary</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prexecutivesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Executive summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prrepsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All' target='_blank'>Rep summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Target wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='prtgzonesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=All&zones=All&regions=All&agents=all' target='_blank'>Zone summary</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtgregionsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Region summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtgagentsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);

printf("<tr><td  style='font-size:13'><a   href='prtgitemsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtgitemrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtgsubrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Sub range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtgzonerangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Zone range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtgregionrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Region range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtgagentrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Agent range summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Trend wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='prhszonesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=All&zones=All&regions=All&agents=all' target='_blank'>Zone summary</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prhsregionsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Region summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prhsagentsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prhsitemsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prhsrangesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtmdays.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Daily sales trend</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtmweeks.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Weekly sales trend</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtmmonths.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Monthly sales trend</a></td></tr></table></div></div>",$tmstarts,$ends);


printf("<div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Tonnage wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='prtgtnitemrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtgtnitemsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr></table></div></div>",$starts,$ends);

$sqlst="select pradmrq from acs where user_names='".$_SESSION['usernames']."' ";
$qry=mysqli_query($conn,$sqlst);
if(mysqli_num_rows($qry)==0){
printf("");}
else{
$rst=mysqli_fetch_row($qry);
if($rst[0]==0){
printf("");}
else{
printf("<br><div class='mnm' id='areasm'><div class='amn' id='amne'><b>Admin panel</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='pruploads.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Primary upload</a></td></tr></div>",$starts,$ends);
#printf("<tr><td  style='font-size:13'><a   href='pruploadsch3.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Channel 3 uploads</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='sruploads.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Sales return Primary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='undlvuploads.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Sales Unload</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='fruploads.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Free issues</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='prtargets.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Target uploads</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='adddb.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Add new agent</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='addir.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Add Direct-Db</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='salesorderupload.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Add Sales Order</a></td></tr>",$starts,$ends);

printf("<tr><td  style='font-size:13'><a   href='pradmadditems.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Add new items</a></td></tr></table></div></div>",$starts,$ends);

}}

#printf("</div>");

printf("</div>");



printf("<div class='dashbs'><a href='prdashbs.php' style='color:#A9BCF5;hover{color:yellow;};'>Main-Dashboard</a></div>");
#printf("<div class='ch11'><a href='#' style='color:#A9BCF5;hover{color:yellow;};'>Chanel-01</a></div>");
#printf("<div class='ch2'><a href='#' style='color:#A9BCF5;hover{color:yellow;};'>Chanel-02</a></div>");
}



function mrshowshps()
{
$conn=mysqli_connect("localhost","primarysales","S5L7lF01EQZvQrGK","primarysales_diana");
if(isset($_REQUEST['starts']) && isset($_REQUEST['ends'])){
$starts=$_REQUEST['starts'];
$ends=$_REQUEST['ends'];}
else{
$starts=0;
$ends=0;

$months=date('m');
$days=date('t');
$years=date('Y');

if($starts==0 || $starts==''){
$starts=$years."-".$months."-01";}
if($ends==0 || $ends==''){
$ends=$years."-".$months."-".$days;}

$tmstarts=$years."-".($months-5)."-01";
}

printf("<div class='sides'>");

printf("<br><div class='mnm' id='areasm'><div class='amn' id='amne'><b>Area wise reports</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='mradds.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'><B>Add MRN</D></a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrzonewisesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Zone summary</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrregionwisesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Region summary</a></td></tr>",$starts,$ends);

printf("<tr><td  style='font-size:13'><a   href='mragentwisesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Agency summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrzonereasonsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Zone reason summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrregionreasonsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Region reason summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mragentreasonsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Agency reason summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrterritorywisesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Territory summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrdaysummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&actpr=0&regions=all&territorys=all&zones=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Day summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrnotessummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Notes smmary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='agentsm'><div class='amn' id='amnc'><b>Range & item reports</b></div>");
printf("<div class='sbm' id='itemsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='mrrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Range summary</a></td></tr></div>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrsubrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Subrange summary</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='mritemsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&subranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Item summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='agentsm'><div class='amn' id='amnc'><b>Range detail reports</b></div>");
printf("<div class='sbm' id='itemsb' style='display:block'><table><tr><td  style='font-size:13'><a href='mrrangezonesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Range zone summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrrangeregionsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Range region summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrrangeagentsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Range agent summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrrangereasonsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Range reason summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrsubrangereasonsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Subrange reason summ</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='mrrangeactionsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Range action summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='agentsm'><div class='amn' id='amnc'><b>Range wise reports</b></div>");
printf("<div class='sbm' id='itemsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='mrzonesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Zone wise summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrregionsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Region wise summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mragentsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Agent wise summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrreasonsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason wise summary</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='mractionsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&subranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Action summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='agentsm'><div class='amn' id='amnc'><b>Reason & action reports</b></div>");
printf("<div class='sbm' id='itemsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='mrreasonwisesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=All' target='_blank'>Reason summary</a></td></tr></div>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrtypesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Type summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mractionwisesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Action summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='agentsm'><div class='amn' id='amnc'><b>Reason detail reports</b></div>");
printf("<div class='sbm' id='itemsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='mrreasonrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason range summary</a></td></tr></div>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrreasonsubrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason subrange summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrreasonitemsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason item summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrreasonactionsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason action summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrreasonzonesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason zone summary</a></td></tr>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='mrreasonregionsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason region summary</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='mrreasonagentsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason agent summary</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='mrdetailsagentsdn.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Detail agent summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<br><div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Trend wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='mrhszonesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=All&zones=All&regions=All&agents=all&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Zone summary</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrhsregionsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Region summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrhsagentsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrhsitemsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrhsreasonsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Reason summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrhsactionsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Action summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrhsrangesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrhssubrangesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all' target='_blank'>Subrange summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<br><div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Movement reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='mrtmdays.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all'>Daily return trend</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrtmweeks.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all'>Weekly return trend</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='mrtmmonths.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank&regions=all&agents=all&ranges=all&subranges=all&items=all&reaons=all&mrtypes=all&actions=all&territorys=all'>Monthly return trend</a></td></tr></table></div></div>",$tmstarts,$ends);

$sqlst="select pradmrq from acs where user_names='".$_SESSION['usernames']."' ";
$qry=mysqli_query($conn,$sqlst);
if(mysqli_num_rows($qry)==0){
printf("");}
else{
$rst=mysqli_fetch_row($qry);
if($rst[0]==0){
printf("");}
else{
printf("<br><div class='mnm' id='areasm'><div class='amn' id='amne'><b>Admin panel</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='pruploads.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Primary upload</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='pruploadsch3.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Channel 3 uploads</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='pruploadsch3.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Channel 3 uploads</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='sruploads.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Sales return uploads</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='pradmaddagents.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Add new agent</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='pragentsinvoices.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Invoice list</a></td></tr></table></div></div>",$starts,$ends);
}}

printf("</div>");

printf("<div class='dashbs'><a href='mrdashbs.php' style='color:#A9BCF5;hover{color:yellow;};'>Dashboard</a></div>");

}


function reportdets($pr)
{
printf("<div class='dts'><table style='font-size:14'><tr style='border-bottom:1px solid silver;'><td width=200><b><font color=#0066cc>Report details</font></td></tr</table>");
printf("<table><table style='font-size:14'>");
printf("<tr><td>Title:</td><td>%s</td></tr>",$pr);

$starts=$_REQUEST['starts'];
$ends=$_REQUEST['ends'];

printf("<tr><td>From:</td><td>%s</td></tr>",$starts);
printf("<tr><td>To:</td><td>%s</td></tr>",$ends);

if(isset($_REQUEST['zones'])){
$zones=$_REQUEST['zones'];
printf("<tr><td>Zone:</td><td>%s</td></tr>",$zones);}
else{
$zones="All";}

if(isset($_REQUEST['regions'])){
$regions=$_REQUEST['regions'];
printf("<tr><td>Region:</td><td>%s</td></tr>",$regions);}
else{
$regions="All";}

if(isset($_REQUEST['territorys'])){
$territorys=$_REQUEST['territorys'];
printf("<tr><td>Territory:</td><td>%s</td></tr>",$territorys);}
else{
$territorys="All";}

if(isset($_REQUEST['agents'])){
$agents=$_REQUEST['agents'];
printf("<tr><td>Agent:</td><td>%s</td></tr>",$agents);}
else{
$agents="All";}

if(isset($_REQUEST['rsms'])){
$rsms=$_REQUEST['rsms'];
printf("<tr><td>RSM:</td><td>%s</td></tr>",$rsms);}
else{
$rsms="All";}

if(isset($_REQUEST['executives'])){
$executives=$_REQUEST['executives'];
printf("<tr><td>Executive:</td><td>%s</td></tr>",$executives);}
else{
$executives="All";}

if(isset($_REQUEST['reps'])){
$reps=$_REQUEST['reps'];
printf("<tr><td>Rep:</td><td>%s</td></tr>",$reps);}
else{
$reps="All";}

if(isset($_REQUEST['ranges'])){
$ranges=$_REQUEST['ranges'];
printf("<tr><td>Range:</td><td>%s</td></tr>",$ranges);}
else{
$ranges="All";}

if(isset($_REQUEST['subranges'])){
$subranges=$_REQUEST['subranges'];
printf("<tr><td>Sub-range:</td><td>%s</td></tr>",$subranges);}
else{
$subranges="All";}

if(isset($_REQUEST['items'])){
$items=$_REQUEST['items'];
printf("<tr><td>Item:</td><td>%s</td></tr>",$items);}
else{
$items="All";}

if(isset($_REQUEST['mrtypes'])){
$mrtypes=$_REQUEST['mrtypes'];
printf("<tr><td>Reason:</td><td>%s</td></tr>",$mrtypes);}
else{
$mrtypes="All";}

if(isset($_REQUEST['mrreasons'])){
$mrreasons=$_REQUEST['mrreasons'];
printf("<tr><td>Type:</td><td>%s</td></tr>",$mrreasons);}
else{
$mrreasons="All";}

if(isset($_REQUEST['mractions'])){
$mractions=$_REQUEST['mractions'];
printf("<tr><td>Action:</td><td>%s</td></tr>",$mractions);}
else{
$mractions="All";}

printf("</table></div>");

}



function showsrds()
{
$conn=mysqli_connect("localhost","primarysales","S5L7lF01EQZvQrGK","primarysales_diana");
if(isset($_REQUEST['starts']) && isset($_REQUEST['ends'])){
$starts=$_REQUEST['starts'];
$ends=$_REQUEST['ends'];}
else{
$starts=0;
$ends=0;

$months=date('m');
$days=date('t');
$years=date('Y');

if($starts==0 || $starts==''){
$starts=$years."-".$months."-01";}
if($ends==0 || $ends==''){
$ends=$years."-".$months."-".$days;}

$tmstarts=$years."-".($months-5)."-01";
}

printf("<div class='sides'>");

printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>Main Panel</b></div>");
//printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='rdsalesday.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Add-Dsr</a></td></tr></div>",$starts,$ends);
#printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='rddbentryfrm.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>DB-RD</a></td></tr></div>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='#' target='_blank'>Sales-Rtn</a></td></tr></table></div></div>",$starts,$ends);
#printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='addcus.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Add-Customer</a></td></tr></div>",$starts,$ends);
#printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='updatecus.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Update-Customer</a></td></tr></table></div></div>",$starts,$ends);



printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>DB-Accounts</b></div>");
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='rdprofs.php?rpsty=agentsitems&starts=%s&ends=%s&sprftypes=agents&params=none' target='_blank'>Agency profile</a>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='rdstatements.php?rpsty=agentsummarys&actp=ntgs&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Rd-statement</a></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>Stock-Reports</b></div>");
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='stkrange.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All'' target='_blank'>Stock-Range</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a href='stkitem.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Stock-Item</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>Rd-Sales-Reports</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='rdregions.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Regional summary</a></td></tr>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='rdtgagentsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);


printf("<tr><td  style='font-size:13'><a href='rdagentsinvoices.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Rd-log book</a></td></tr>",$starts,$ends);

printf("<tr><td  style='font-size:13'><a   href='rdagentsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All' target='_blank'>Agent Range summary</a></td></tr>",$starts,$ends);

printf("<div class='sbm' id='itemsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='rdrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=All' target='_blank'>Range summary</a></td></tr></div>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='rdsubrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all' target='_blank'>Sub Range summary</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='rditemsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=all&territorys=all&ranges=all&subranges=all' target='_blank'>Item summary</a></td></tr></table></div></div>",$starts,$ends);

#printf("<div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Target wise reports</b></div>");
#printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='rdtgagentsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);

#printf("<tr><td  style='font-size:13'><a   href='rdtgitemsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
#printf("<tr><td  style='font-size:13'><a   href='rdtgitemrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item range summary</a></td></tr>",$starts,$ends);
#printf("<tr><td  style='font-size:13'><a   href='rdtgsubrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Sub range summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Trend wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='rdhsitemsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='rdhsrangesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='rdtmdays.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Daily sales trend</a></td></tr></table></div></div>",$tmstarts,$ends);

printf("<br><div class='mnm' id='areasm'><div class='amn' id='amne'><b>Admin panel</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='#'>Channel-01</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='#'>Channel-02</a></td></tr></table></div></div>",$starts,$ends);

printf("</div>");

printf("<div class='dashbs'><a href='rddashbs.php' style='color:#A9BCF5;hover{color:yellow;};'>Dashboard</a></div>");
}




function showsdsr()
{
$conn=mysqli_connect("localhost","primarysales","S5L7lF01EQZvQrGK","primarysales_diana");
if(isset($_REQUEST['starts']) && isset($_REQUEST['ends'])){
$starts=$_REQUEST['starts'];
$ends=$_REQUEST['ends'];}
else{
$starts=0;
$ends=0;

$months=date('m');
$days=date('t');
$years=date('Y');

if($starts==0 || $starts==''){
$starts=$years."-".$months."-01";}
if($ends==0 || $ends==''){
$ends=$years."-".$months."-".$days;}

$tmstarts=$years."-".($months-5)."-01";
}

printf("<div class='sides'>");

printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>Main Panel</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='dsrday.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Add-Dsr</a></td></tr></div>",$starts,$ends);
#printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='rddbentryfrm.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>DB-RD</a></td></tr></div>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='disadd.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Add-Discount</a></td></tr></table></div></div>",$starts,$ends);
#printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='addcus.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Add-Customer</a></td></tr></div>",$starts,$ends);
#printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a href='updatecus.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Update-Customer</a></td></tr></table></div></div>",$starts,$ends);



printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>DB-Accounts</b></div>");
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='freenotessummary.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Free Issues Notes</a>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='discountnotesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Discounts Notes</a>",$starts,$ends);
##printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='freesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Free Issues Summary</a>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='freeitemssumary.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Free Items Summary</a>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='discountsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&zones=All&agents=all' target='_blank'>Discount Summary</a></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>Stock-Reports</b></div>");
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='#' target='_blank'>Stock-Range</a></td></tr>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='font-size:13'><table><a href='#' target='_blank'>Stock-Item</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a href='reorderlevel.php' target='_blank'>Re-Order Level</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='areasm'><div class='amn' id='amne'><b>Rd-Sales-Reports</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='#' target='_blank'>Regional summary</a></td></tr>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='dsrrdtgagentsummary.php' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a href='dsrdagentsinvoices.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&territorys=all&zones=All' target='_blank'>Rd-log book</a></td></tr>",$starts,$ends);

printf("<tr><td  style='font-size:13'><a   href='#' target='_blank'>Agent Range summary</a></td></tr>",$starts,$ends);
printf("<div class='sbm' id='itemsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='#' target='_blank'>Range summary</a></td></tr></div>",$starts,$ends);
printf("<tr ><td style='font-size:13'><a   href='#' target='_blank'>Sub Range summary</a></td></tr>",$starts,$ends);
printf("<tr ><td  style='font-size:13'><a   href='#' target='_blank'>Item summary</a></td></tr></table></div></div>",$starts,$ends);

#printf("<div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Target wise reports</b></div>");
#printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='rdtgagentsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);

#printf("<tr><td  style='font-size:13'><a   href='rdtgitemsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
#printf("<tr><td  style='font-size:13'><a   href='rdtgitemrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item range summary</a></td></tr>",$starts,$ends);
#printf("<tr><td  style='font-size:13'><a   href='rdtgsubrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Sub range summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Trend wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='#' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='#' target='_blank'>Item range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='#' target='_blank'>Daily sales trend</a></td></tr></table></div></div>",$tmstarts,$ends);

printf("<br><div class='mnm' id='areasm'><div class='amn' id='amne'><b>Admin panel</b></div>");
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='dsrcheck.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Check Mode</a></td></tr></div>",$starts,$ends);
printf("<div class='sbm' id='areasb' style='display:block'><table><tr><td  style='font-size:13'><a   href='#'>Channel-01</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='#'>Channel-02</a></td></tr></table></div></div>",$starts,$ends);
printf("</div>");
printf("<div class='dashbs'><a href='dsrddashbs.php' style='color:#A9BCF5;hover{color:yellow;};'>Dashboard</a></div>");
}


function showsp2r()
{
$conn=mysqli_connect("localhost","primarysales","S5L7lF01EQZvQrGK","primarysales_diana");
if(isset($_REQUEST['starts']) && isset($_REQUEST['ends'])){
$starts=$_REQUEST['starts'];
$ends=$_REQUEST['ends'];}
else{
$starts=0;
$ends=0;

$months=date('m');
$days=date('t');
$years=date('Y');

if($starts==0 || $starts==''){
$starts=$years."-".$months."-01";}
if($ends==0 || $ends==''){
$ends=$years."-".$months."-".$days;}

$tmstarts=$years."-".($months-5)."-01";
}

printf("<div class='sides'>");

printf("<br><div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Target wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='wptrzonesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=All&zones=All&regions=All&agents=all' target='_blank'>Zone summary</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrgregionsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Region summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptragentsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrterritorysummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Territory summary</a></td></tr>",$starts,$ends);

printf("<tr><td  style='font-size:13'><a   href='wptritemsummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrsubrangesummarys.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Sub range summary</a></td></tr></table></div></div>",$starts,$ends);

printf("<br><div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Trend wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='wptrhszonesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=All&zones=All&regions=All&agents=all' target='_blank'>Zone summary</a></td></tr></div>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrhsregionsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Region summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrhsagentsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=All&agents=All&territorys=All&zones=All&rsms=All&executives=All' target='_blank'>Agent summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrhsitemsummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrhsrangesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item range summary</a></td></tr>",$tmstarts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrhssubrangesummary.php?rpsty=agentsummarys&dtd=all&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Subrange summary</a></td></tr></table></div></div>",$tmstarts,$ends);


printf("<br><div class='mnm' id='temsm' ><div class='amn' id='amnf' ><b>Tonnage wise reports</b></div>");
printf("<div class='sbm' id='teamsb' style='display:block'><table><tr><td  style='font-size:13'><a   href='wptrtnitemrangesummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Range summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrtnsubrangemsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Subrange summary</a></td></tr>",$starts,$ends);
printf("<tr><td  style='font-size:13'><a   href='wptrtnitemsummary.php?rpsty=agentsummarys&starts=%s&ends=%s&regions=all&agents=All&territorys=all&ranges=all&zones=All&rsms=All&executives=All&reps=All&items=All' target='_blank'>Item summary</a></td></tr></table></div></div>",$starts,$ends);

printf("</div>");

printf("<div class='dashbs'><a href='prdashbs.php' style='color:#A9BCF5;hover{color:yellow;};'>Dashboard</a></div>");
}
?>