Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customer Registration Report


Guest

Recommended Posts

This thread is for the contribution Customer Registration Report found here: http://www.oscommerce.com/community/contributions,2774

 

I am just adding to this contribution, but need some help doing so. I am not good in JavaScript & this is where I need help. From the picture below you can see what this screen looks like & you can also see the JavaScript calendar. This is the basic JavaScript calendar used for the basic Specials. I have posted the code to what I have now & it is functional for only the Start Date JavaScript calendar.

 

What I need help from you is to get the End Date JavaScript calendar working. I have messed around with this for about 2 hours & am not able to get it to work for the End Date JS calendar.

 

<?php
/*================================================================*\
#################################################################### 
#			   Customer Registration Stats v 1.0
#							by Chemo
#
# ---------------------------------------------------------------- # 
# --------- Released under the GNU General Public License -------- #
# ---------------------------------------------------------------- #
# 
# 							* CREDITS *
#		 This report is based on the work of Charly Wilhelm 
#
# 							* ABOUT *
#	This contribution was created to generate customer registration
#	reports for an osCommerce store.  Reports can be generated on a
#	daily, weekly, monthly, or yearly timeframe.
#
# 	This report is self contained and only one file needs to be
#	uploaded.  
#
#	Add a link to the page in admin/includes/boxes/reports.php
####################################################################
\*================================================================*/

  require ('includes/application_top.php');

# Begin class definition
class creport {
var $begindate, $enddate, $globalstartdate, $globalenddate, $mode, $numrecords;
var $values = array();
function creport () {
  $firstQuery = tep_db_query("select UNIX_TIMESTAMP(min(customers_info_date_account_created)) as first FROM customers_info");
  $first = tep_db_fetch_array($firstQuery);

  $this->globalstartdate = mktime(0, 0, 0, date("m", $first['first']), date("d", $first['first']), date("Y", $first['first']));
  $this->begindate = $this->globalstartdate;	 
  $this->globalenddate = mktime(0, 0, 0, date("m", time()), date("d", time()), date("Y", time()));
  $this->enddate = $this->globalenddate;
  $this->enddateclean = date("F j, Y", $this->enddate);

  $timeframequery = "SELECT * FROM `customers_info` WHERE UNIX_TIMESTAMP(`customers_info_date_account_created`) >= '".$this->globalstartdate."' AND UNIX_TIMESTAMP(`customers_info_date_account_created`) <= '".$this->enddate."'";
  $timeframearray = tep_db_query($timeframequery);
  $this->numrecords = mysql_num_rows($timeframearray);	
}

function getnext() {
if ($this->begindate < $this->globalstartdate) {
	$this->begindate = $this->globalstartdate;
  } 
  switch ($this->mode) {
	// yearly
	case '1':
	  $sd = $this->begindate;
	  $ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd), date("Y", $sd) + 1);
	  break;
	// monthly
	case '2':
	  $sd = $this->begindate;
	  $ed = mktime(0, 0, 0, date("m", $sd) + 1, 1, date("Y", $sd));
	  break;
	// weekly
	case '3':
	  $sd = $this->begindate;
	  $ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd) + 7, date("Y", $sd));
	  break;
	// daily
	case '4':
	  $sd = $this->begindate;
	  $ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd) + 1, date("Y", $sd));
	  break;
	default:
	  $sd = $this->begindate;
	  $ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd) + 7, date("Y", $sd));
	  break;

  }//end switch
  if ($this->enddate > $this->globalenddate) $this->enddate = $this->globalenddate; 
  if ($ed > $this->enddate) $ed = $this->enddate;

  $timeframequery = "SELECT * FROM `customers_info` WHERE UNIX_TIMESTAMP(`customers_info_date_account_created`) >= '".$sd."' AND UNIX_TIMESTAMP(`customers_info_date_account_created`) <= '".$ed."'";
  $this->begindate = $ed;	  
  $timeframearray = tep_db_query($timeframequery);
  $this->numrecords = mysql_num_rows($timeframearray);
  $this->values[] = $this->numrecords;
  echo '<tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'"><td width="125px" align="left" class="dataTableContent">'.date("D M j, y", $sd).'</td><td width="125px" align="left" class="dataTableContent">'. date("D M j, y", $ed).'</td><td class="dataTableContent"><b>'.$this->numrecords.'</b></td></tr>'; 		
}# end getnext
}# end creport class

# Crete a new instance of the creport class
$report = new creport; 

if ( $_POST['mode'] ) 
{	
	$mode = $_POST['mode'];
  }
  if ($mode < 1 || $mode > 4) {
	$mode = 2;
  }
  if ($_POST['start_day'] && $_POST['start_month'] && $_POST['start_year']){
  $report->begindate = mktime(0, 0, 0, $_POST['start_month'], $_POST['start_day'], $_POST['start_year']); }
if ($_POST['end_day'] && $_POST['end_month'] && $_POST['end_year']){
  $report->enddate = mktime(0, 0, 0, $_POST['end_month'], $_POST['end_day'], $_POST['end_year']); }
$report->mode = $mode;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Customer Account Creation Report</title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
<link rel="stylesheet" type="text/css" href="includes/javascript/calendar.css">
<script language="JavaScript" src="includes/javascript/calendarcode.js"></script>
<script language="JavaScript" src="includes/javascript/calendarcode_end.js"></script> 
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<div id="popupcalendar" class="text"></div>
	<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
	<td width="<?php echo BOX_WIDTH; ?>" valign="top">
		<table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
	<!-- left_navigation //-->
	<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
	<!-- left_navigation_eof //-->
		  </table>
	</td>
  <td valign="top" class"menuBoxHeading">
	<p class="pageHeading">Customer Report</p>
	<p class="main">Data from <b><?php  echo date("D M j, Y", $report->begindate); ?></b> through <b><?php  echo date("D M j, Y", $report->enddate); ?></b></p>		
	<p class="menuBoxHeading">Total customer accounts: <b><?php  echo $report->numrecords; ?></b></p>		
<form name="options" method="post" action="<? echo $PHP_SELF; ?>" class="menuBoxHeading">
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td valign="top" width="125px">

	  <input name="mode" type="radio" value="1" <? if ($mode == 1) echo "checked"; ?>> Yearly<br>
	  <input name="mode" type="radio" value="2" <? if ($mode == 2) echo "checked"; ?>> Monthly<br>
	  <input name="mode" type="radio" value="3" <? if ($mode == 3) echo "checked"; ?>> Weekly<br>
	  <input name="mode" type="radio" value="4" <? if ($mode == 4) echo "checked"; ?>> Daily<br>
	  </td>
			<td valign="top">
		  <table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
			  <td>
				  <b>Begin Date</b> (d m Y)<br>
				<input name="start_month" type="text" value="<? echo date("n", $report->begindate); ?>" size="2" maxlength="2">
				<input name="start_day" type="text" size="2" maxlength="2" value="<? echo date("j", $report->begindate); ?>">
				<input name="start_year" type="text" size="4" maxlength="4" value="<? echo date("Y", $report->begindate); ?>">  <a class="so-BtnLink" href="java script:cal_start_Click();return false;" onMouseOver="cal_start_SwapImg('BTN_date', 'img_Date_OVER',true);" onMouseOut="cal_start_SwapImg('BTN_date', 'img_Date_UP',true);" onClick="cal_start_SwapImg('BTN_date', 'img_Date_DOWN');show_start_Calendar('options','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a>				   
			   </td>
			</tr>
			<tr>
			<td><br>
				  <b>End Date</b> (d m Y)<br>
				<input name="end_month" type="text" value="<? echo date("n", $report->enddate); ?>" size="2" maxlength="2">
				<input name="end_day" type="text" value="<? echo date("j", $report->enddate); ?>" size="2" maxlength="2">
				<input name="end_year" type="text" size="4" value="<? echo date("Y", $report->enddate); ?>"  maxlength="4">  <a class="so-BtnLink" href="java script:cal_end_Click();return false;" onMouseOver="cal_end_SwapImg('BTN_date', 'img_Date_OVER',true);" onMouseOut="cal_end_SwapImg('BTN_date', 'img_Date_UP',true);" onClick="cal_end_SwapImg('BTN_date', 'img_Date_DOWN');show_end_Calendar('options','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a>
				 <input type="submit" name="Submit" value="Submit"></form>	
			</td>
			</tr>
			</table>

			</td>
			</tr></table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="dataTableHeadingRow"><td width="125px" align="left" class="dataTableHeadingContent">Begin Date</td><td width="125px" align="left" class="dataTableHeadingContent">End Date</td><td align="left" class="dataTableHeadingContent">Number of Accounts Created</td></tr>
<?

while ($report->begindate < $report->enddate) {
 $report->getnext();
 }
?>  

  </table>
  </td></tr></table>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php');?>

 

registrations.gif

Link to comment
Share on other sites

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...