Initial import: Carteasy Shop (Dev-Stand)
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*
|
||||
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
|
||||
* @package Carteasy
|
||||
* @copyright Copyright (C) 2005 - 2011 Wlanium
|
||||
* @license proprietary
|
||||
* @author Thomas Bartelt
|
||||
* Carteasy is a web shop system
|
||||
*/
|
||||
|
||||
|
||||
class new_customer_registrations {
|
||||
private $base_object;
|
||||
|
||||
function __construct($base_object) {
|
||||
$this->base_object = $base_object;
|
||||
$this->db = $base_object->db;
|
||||
} // end __construct
|
||||
|
||||
function run($filter) {
|
||||
// get customer registrations
|
||||
$sql = "SELECT registration_date FROM customers
|
||||
WHERE registration_date >= '".$filter['date_start']."'
|
||||
AND registration_date <= '".$filter['date_end']."'";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$data = array();
|
||||
// statistic of a year
|
||||
if ($filter['period'] == 'year') {
|
||||
// get stat data
|
||||
$sum = array(0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
while ($obj = $result->fetch_object()) {
|
||||
$m = substr($obj->registration_date, 5, 2);
|
||||
$index = intval($m) - 1;
|
||||
$sum[$index]++;
|
||||
}
|
||||
|
||||
// make table
|
||||
$data = array(
|
||||
array('Monat', 'neue Kundenregistrierung'),
|
||||
array('Januar', $sum[0]),
|
||||
array('Februar', $sum[1]),
|
||||
array('März', $sum[2]),
|
||||
array('April', $sum[3]),
|
||||
array('Mai', $sum[4]),
|
||||
array('Juni', $sum[5]),
|
||||
array('Juli', $sum[6]),
|
||||
array('August', $sum[7]),
|
||||
array('September', $sum[8]),
|
||||
array('Oktober', $sum[9]),
|
||||
array('November', $sum[10]),
|
||||
array('Dezember', $sum[11])
|
||||
);
|
||||
} else if ($filter['period'] == 'month') { // statistic of a month
|
||||
$year = substr($filter['date_start'],0,4);
|
||||
$month = substr($filter['date_start'],5,2);
|
||||
$day = substr($filter['date_start'],8,2);
|
||||
|
||||
// get max month days
|
||||
$monat = mktime(0, 0, 0, $month, 1, $year);
|
||||
$max_days_of_month = date("t", $monat);
|
||||
|
||||
// get stat data
|
||||
$sum = array();
|
||||
for ($z=1;$z<=$max_days_of_month;$z++) {
|
||||
$sum[] = 0;
|
||||
}
|
||||
while ($obj = $result->fetch_object()) {
|
||||
$m = substr($obj->registration_date, 8, 2);
|
||||
$index = intval($m) - 1;
|
||||
$sum[$index]++;
|
||||
}
|
||||
|
||||
// make table
|
||||
$data[] = array('Tag', 'neue Kundenregistrierung');
|
||||
for ($z=1;$z<=$max_days_of_month;$z++) {
|
||||
$i = $z - 1;
|
||||
$data[] = array($z, $sum[$i]);
|
||||
}
|
||||
} else if ($filter['period'] == 'day') { // statistic of a day
|
||||
$year = substr($filter['date_start'],0,4);
|
||||
$month = substr($filter['date_start'],5,2);
|
||||
$day = substr($filter['date_start'],8,2);
|
||||
$date = $day.'.'.$month.'.'.$year;
|
||||
|
||||
|
||||
// get stat data
|
||||
$sum = 0;
|
||||
while ($obj = $result->fetch_object()) {
|
||||
$m = substr($obj->registration_date, 8, 2);
|
||||
$index = intval($m) - 1;
|
||||
$sum++;
|
||||
}
|
||||
|
||||
// make table
|
||||
$data = array(
|
||||
array('', 'neue Kundenregistrierung'),
|
||||
array($date, $sum)
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/*
|
||||
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
|
||||
* @package Carteasy
|
||||
* @copyright Copyright (C) 2005 - 2011 Wlanium
|
||||
* @license proprietary
|
||||
* @author Thomas Bartelt
|
||||
* Carteasy is a web shop system
|
||||
*/
|
||||
|
||||
include_once './core/orderstatus.class.php';
|
||||
|
||||
class new_orders {
|
||||
private $base_object;
|
||||
|
||||
function __construct($base_object) {
|
||||
$this->base_object = $base_object;
|
||||
$this->db = $base_object->db;
|
||||
} // end __construct
|
||||
|
||||
function run($filter) {
|
||||
// get order states
|
||||
$order_state_object = new OrderStatus($this->base_object);
|
||||
$order_states = $order_state_object->get_all();
|
||||
|
||||
// get customer registrations
|
||||
$sql = "SELECT id, order_date, order_status FROM orders
|
||||
WHERE order_date >= '".$filter['date_start']."'
|
||||
AND order_date <= '".$filter['date_end']."'
|
||||
AND revised_order_id = 0";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$data = array();
|
||||
$first_row = array('Monat', 'neue Bestellungen');
|
||||
foreach ($order_states as $state) {
|
||||
$first_row[] = 'davon '.$state->name;
|
||||
}
|
||||
// statistic of a year
|
||||
if ($filter['period'] == 'year') {
|
||||
// first inital
|
||||
$sum = array();
|
||||
for ($i=0;$i<12;$i++) {
|
||||
$cols = array('all' => 0);
|
||||
foreach ($order_states as $order_state) {
|
||||
$cols['id_'.$order_state->id] = 0;
|
||||
}
|
||||
$sum[] = $cols;
|
||||
}
|
||||
|
||||
// get stat data
|
||||
while ($obj = $result->fetch_object()) {
|
||||
$m = substr($obj->order_date, 5, 2);
|
||||
$index = intval($m) - 1;
|
||||
$sum[$index]['all']++;
|
||||
$sum[$index]['id_'.$obj->order_status]++;
|
||||
}
|
||||
|
||||
// make table
|
||||
$data = array($first_row);
|
||||
$months = array('Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember');
|
||||
$month = array();
|
||||
for ($i=0;$i<12;$i++) {
|
||||
$cols = array($months[$i], $sum[$i]['all']);
|
||||
foreach ($order_states as $order_state) {
|
||||
$cols[] = $sum[$i]['id_'.$order_state->id];
|
||||
}
|
||||
$data[] = $cols;
|
||||
}
|
||||
|
||||
} else if ($filter['period'] == 'month') { // statistic of a month
|
||||
$year = substr($filter['date_start'],0,4);
|
||||
$month = substr($filter['date_start'],5,2);
|
||||
$day = substr($filter['date_start'],8,2);
|
||||
|
||||
// get max month days
|
||||
$monat = mktime(0, 0, 0, $month, 1, $year);
|
||||
$max_days_of_month = date("t", $monat);
|
||||
|
||||
// get stat data
|
||||
$sum = array();
|
||||
for ($z=1;$z<=$max_days_of_month;$z++) {
|
||||
$cols = array('all' => 0);
|
||||
foreach ($order_states as $order_state) {
|
||||
$cols['id_'.$order_state->id] = 0;
|
||||
}
|
||||
$sum[] = $cols;
|
||||
}
|
||||
while ($obj = $result->fetch_object()) {
|
||||
$m = substr($obj->order_date, 8, 2);
|
||||
$index = intval($m) - 1;
|
||||
$sum[$index]['all']++;
|
||||
$sum[$index]['id_'.$obj->order_status]++;
|
||||
}
|
||||
|
||||
// make table
|
||||
$first_row[0] = 'Tag';
|
||||
$data = array($first_row);
|
||||
for ($z=1;$z<=$max_days_of_month;$z++) {
|
||||
$i = $z - 1;
|
||||
$cols = array($z, $sum[$i]['all']);
|
||||
foreach ($order_states as $order_state) {
|
||||
$cols[] = $sum[$i]['id_'.$order_state->id];
|
||||
}
|
||||
$data[] = $cols;
|
||||
}
|
||||
} else if ($filter['period'] == 'day') { // statistic of a day
|
||||
$year = substr($filter['date_start'],0,4);
|
||||
$month = substr($filter['date_start'],5,2);
|
||||
$day = substr($filter['date_start'],8,2);
|
||||
$date = $day.'.'.$month.'.'.$year;
|
||||
|
||||
|
||||
// get stat data
|
||||
$sum = array();
|
||||
$cols = array('all' => 0);
|
||||
foreach ($order_states as $order_state) {
|
||||
$cols['id_'.$order_state->id] = 0;
|
||||
}
|
||||
$sum[] = $cols;
|
||||
|
||||
while ($obj = $result->fetch_object()) {
|
||||
$m = substr($obj->order_date, 8, 2);
|
||||
$sum[0]['all']++;
|
||||
$sum[0]['id_'.$obj->order_status]++;
|
||||
}
|
||||
|
||||
// make table
|
||||
$first_row[0] = 'Datum';
|
||||
$data = array($first_row);
|
||||
$cols = array($date, $sum[0]['all']);
|
||||
foreach ($order_states as $order_state) {
|
||||
$cols[] = $sum[0]['id_'.$order_state->id];
|
||||
}
|
||||
$data[] = $cols;
|
||||
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user