PDF rausgenommen
This commit is contained in:
70
msd2/myoos/admin/includes/classes/class_box.php
Normal file
70
msd2/myoos/admin/includes/classes/class_box.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: class_box.php,v 1.1 2007/06/08 14:58:10 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: box.php,v 1.5 2002/03/16 00:20:11 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
----------------------------------------------------------------------
|
||||
Example usage:
|
||||
|
||||
$heading = array();
|
||||
$heading[] = array('params' => 'class="menuBoxHeading"',
|
||||
'text' => BOX_HEADING_TOOLS,
|
||||
'link' => oos_href_link_admin(basename($_SERVER['PHP_SELF']), oos_get_all_get_params(array('selected_box')) . 'selected_box=tools'));
|
||||
|
||||
$contents = array();
|
||||
$contents[] = array('text' => SOME_TEXT);
|
||||
|
||||
$box = new box;
|
||||
echo $box->infoBox($heading, $contents);
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
class box extends tableBlock {
|
||||
public function __construct() {
|
||||
$this->heading = array();
|
||||
$this->contents = array();
|
||||
}
|
||||
|
||||
public function infoBox($heading, $contents) {
|
||||
$this->heading = '<thead class="thead-dark">' . $this->tableThead($heading) . '</thead>';
|
||||
|
||||
$this->contents = '<tbody>' . $this->tableBlock($contents) . '</tbody>';
|
||||
|
||||
return $this->heading . $this->contents;
|
||||
}
|
||||
|
||||
public function menuBox($heading, $contents) {
|
||||
|
||||
$this->table_data_parameters = 'class="menuBoxHeading"';
|
||||
if ($heading[0]['link']) {
|
||||
$this->table_data_parameters .= ' onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . $heading[0]['link'] . '\'"';
|
||||
$heading[0]['text'] = ' <a href="' . $heading[0]['link'] . '" class="menuBoxHeadingLink">' . $heading[0]['text'] . '</a> ';
|
||||
} else {
|
||||
$heading[0]['text'] = ' ' . $heading[0]['text'] . ' ';
|
||||
}
|
||||
$this->heading = $this->tableBlock($heading);
|
||||
|
||||
$this->table_data_parameters = 'class="menuBoxContent"';
|
||||
$this->contents = $this->tableBlock($contents);
|
||||
|
||||
return $this->heading . $this->contents;
|
||||
|
||||
}
|
||||
}
|
||||
|
75
msd2/myoos/admin/includes/classes/class_currencies.php
Normal file
75
msd2/myoos/admin/includes/classes/class_currencies.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: class_currencies.php,v 1.1 2007/06/08 14:58:10 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: currencies.php,v 1.2 2002/09/01 13:47:06 project3000
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
class currencies {
|
||||
var $currencies;
|
||||
|
||||
// class constructor
|
||||
public function __construct() {
|
||||
|
||||
$this->currencies = array();
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$query = "SELECT code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value
|
||||
FROM " . $oostable['currencies'];
|
||||
$result = $dbconn->Execute($query);
|
||||
|
||||
while ($currencies = $result->fields) {
|
||||
$this->currencies[$currencies['code']] = array('title' => $currencies['title'],
|
||||
'symbol_left' => $currencies['symbol_left'],
|
||||
'symbol_right' => $currencies['symbol_right'],
|
||||
'decimal_point' => $currencies['decimal_point'],
|
||||
'thousands_point' => $currencies['thousands_point'],
|
||||
'decimal_places' => (int)$currencies['decimal_places'],
|
||||
'value' => $currencies['value']);
|
||||
// Move that ADOdb pointer!
|
||||
$result->MoveNext();
|
||||
}
|
||||
}
|
||||
|
||||
// class methods
|
||||
public function format($number, $calculate_currency_value = TRUE, $currency_type = DEFAULT_CURRENCY, $currency_value = null) {
|
||||
|
||||
$rate = 1;
|
||||
if ($calculate_currency_value === TRUE) {
|
||||
$rate = (!empty($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value'];
|
||||
}
|
||||
|
||||
$format_string = $this->currencies[$currency_type]['symbol_left'] . ' ' . number_format(oos_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . ' ' . $this->currencies[$currency_type]['symbol_right'];
|
||||
|
||||
return $format_string;
|
||||
}
|
||||
|
||||
public function get_value($code) {
|
||||
return $this->currencies[$code]['value'];
|
||||
}
|
||||
|
||||
public function display_price($products_price, $products_tax, $quantity = 1) {
|
||||
return $this->format(oos_add_tax($products_price, $products_tax) * $quantity);
|
||||
}
|
||||
|
||||
}
|
94
msd2/myoos/admin/includes/classes/class_message_stack.php
Normal file
94
msd2/myoos/admin/includes/classes/class_message_stack.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: class_message_stack.php,v 1.1 2007/06/08 14:58:10 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: message_stack.php,v 1.5 2002/11/22 18:45:46 dgw_
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
----------------------------------------------------------------------
|
||||
Example usage:
|
||||
|
||||
$messageStack = new messageStack();
|
||||
$messageStack->add('Error: Error 1', 'error');
|
||||
$messageStack->add('Error: Error 2', 'warning');
|
||||
if ($messageStack->size > 0) echo $messageStack->output();
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
class messageStack {
|
||||
var $size = 0;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$this->errors = array();
|
||||
|
||||
if (isset($_SESSION['messageToStack'])) {
|
||||
for ($i = 0, $n = sizeof($_SESSION['messageToStack']); $i < $n; $i++) {
|
||||
$this->add($_SESSION['messageToStack'][$i]['text'], $_SESSION['messageToStack'][$i]['type']);
|
||||
}
|
||||
unset($_SESSION['messageToStack']);
|
||||
}
|
||||
}
|
||||
|
||||
public function add($message, $type = 'error') {
|
||||
|
||||
if ($type == 'error') {
|
||||
$this->errors[] = array('params' => 'alert-danger', 'text' => $message);
|
||||
} elseif ($type == 'warning') {
|
||||
$this->errors[] = array('params' => 'alert-warning', 'text' => $message);
|
||||
} elseif ($type == 'success') {
|
||||
$this->errors[] = array('params' => 'alert-success', 'text' => $message);
|
||||
} else {
|
||||
$this->errors[] = array('params' => 'alert-info', 'text' => $message);
|
||||
}
|
||||
|
||||
$this->size++;
|
||||
}
|
||||
|
||||
public function add_session($message, $type = 'error') {
|
||||
if (!isset($_SESSION['messageToStack'])) {
|
||||
$_SESSION['messageToStack'] = array();
|
||||
}
|
||||
|
||||
$_SESSION['messageToStack'][] = array('text' => $message, 'type' => $type);
|
||||
}
|
||||
|
||||
public function reset() {
|
||||
$this->errors = array();
|
||||
$this->size = 0;
|
||||
}
|
||||
|
||||
public function output() {
|
||||
$sMessageBox = '';
|
||||
|
||||
$aContents = $this->errors;
|
||||
|
||||
for ($i = 0, $n = count($aContents); $i < $n; $i++) {
|
||||
$sMessageBox .= '<div class="alert';
|
||||
if (isset($aContents[$i]['params']) && oos_is_not_null($aContents[$i]['params'])) {
|
||||
$sMessageBox .= ' ' . $aContents[$i]['params'];
|
||||
}
|
||||
$sMessageBox .= '" role="alert">';
|
||||
if (isset($aContents[$i]['text']) && oos_is_not_null($aContents[$i]['text'])) {
|
||||
$sMessageBox .= ' ' . $aContents[$i]['text'];
|
||||
}
|
||||
$sMessageBox .= '</div>' . "\n";
|
||||
}
|
||||
|
||||
return $sMessageBox;
|
||||
}
|
||||
}
|
52
msd2/myoos/admin/includes/classes/class_object_info.php
Normal file
52
msd2/myoos/admin/includes/classes/class_object_info.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: class_object_info.php,v 1.1 2007/06/08 14:58:10 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: object_info.php,v 1.5 2002/01/30 01:14:20 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
class objectInfo
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
/**
|
||||
* @param $object_array
|
||||
*/
|
||||
function __construct($aObject)
|
||||
{
|
||||
$this->updateObjectInfo($aObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aObject
|
||||
*/
|
||||
function updateObjectInfo($aObject)
|
||||
{
|
||||
if (!is_array($aObject)) return;
|
||||
reset($aObject);
|
||||
foreach ($aObject as $key => $value) {
|
||||
$this->$key = oos_db_prepare_input($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: class_payment_module_info.php,v 1.1 2007/06/08 14:58:10 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
class paymentModuleInfo {
|
||||
var $payment_code;
|
||||
var $keys;
|
||||
|
||||
// class constructor
|
||||
public function __construct($pmInfo_array) {
|
||||
|
||||
$this->payment_code = $pmInfo_array['payment_code'];
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
for ($i = 0, $n = count($pmInfo_array) - 1; $i < $n; $i++) {
|
||||
|
||||
$query = "SELECT configuration_value
|
||||
FROM " . $oostable['configuration'] . "
|
||||
WHERE configuration_key = '" . oos_db_input($pmInfo_array[$i]) . "'";
|
||||
$result = $dbconn->Execute($query);
|
||||
$key_value = $result->fields;
|
||||
|
||||
$this->keys[$pmInfo_array[$i]]['title'] = constant(strtoupper($pmInfo_array[$i] . '_TITLE'));
|
||||
$this->keys[$pmInfo_array[$i]]['value'] = $key_value['configuration_value'];
|
||||
$this->keys[$pmInfo_array[$i]]['description'] = constant(strtoupper($pmInfo_array[$i] . '_DESC'));
|
||||
}
|
||||
}
|
||||
}
|
253
msd2/myoos/admin/includes/classes/class_sales_report2.php
Normal file
253
msd2/myoos/admin/includes/classes/class_sales_report2.php
Normal file
@ -0,0 +1,253 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: class_sales_report2.php,v 1.1 2007/06/08 14:58:10 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: sales_report2.php,v 1.00 2003/03/08 19:25:29
|
||||
----------------------------------------------------------------------
|
||||
Charly Wilhelm charly@yoshi.ch
|
||||
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
class sales_report {
|
||||
var $mode, $GLOBALStartDate, $startDate, $endDate, $actDate, $showDate, $showDateEnd, $sortString, $status, $outlet;
|
||||
|
||||
public function __construct($mode, $startDate = 0, $endDate = 0, $sort = 0, $statusFilter = 0, $filter = 0) {
|
||||
|
||||
// startDate and endDate have to be a unix timestamp. Use mktime !
|
||||
// if set then both have to be valid startDate and endDate
|
||||
$this->mode = $mode;
|
||||
$this->tax_include = DISPLAY_PRICE_WITH_TAX;
|
||||
|
||||
$this->statusFilter = $statusFilter;
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
$firstQuery = $dbconn->Execute("SELECT UNIX_TIMESTAMP(min(date_purchased)) as first FROM " . $oostable['orders']);
|
||||
$first = $firstQuery->fields;
|
||||
$this->GLOBALStartDate = mktime(0, 0, 0, date("m", $first['first']), date("d", $first['first']), date("Y", $first['first']));
|
||||
$statusQuery = $dbconn->Execute("SELECT * FROM " . $oostable['orders_status']);
|
||||
$i = 0;
|
||||
while ($outResp = $statusQuery->fields) {
|
||||
$status[$i] = $outResp;
|
||||
$i++;
|
||||
// Move that ADOdb pointer!
|
||||
$statusQuery->MoveNext();
|
||||
}
|
||||
$this->status = $status;
|
||||
|
||||
|
||||
if ($startDate == 0 or $startDate < $this->GLOBALStartDate) {
|
||||
// set startDate to GLOBALStartDate
|
||||
$this->startDate = $this->GLOBALStartDate;
|
||||
} else {
|
||||
$this->startDate = $startDate;
|
||||
}
|
||||
if ($this->startDate > mktime(0, 0, 0, date("m"), date("d"), date("Y"))) {
|
||||
$this->startDate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
|
||||
}
|
||||
|
||||
if ($endDate > mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))) {
|
||||
// set endDate to tomorrow
|
||||
$this->endDate = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
|
||||
} else {
|
||||
$this->endDate = $endDate;
|
||||
}
|
||||
if ($this->endDate < $this->startDate + 24 * 60 * 60) {
|
||||
$this->endDate = $this->startDate + 24 * 60 * 60;
|
||||
}
|
||||
|
||||
$this->actDate = $this->startDate;
|
||||
|
||||
// query for order count
|
||||
$this->queryOrderCnt = "SELECT count(o.orders_id) as order_cnt FROM " . $oostable['orders'] . " o";
|
||||
|
||||
// queries for item details count
|
||||
$this->queryItemCnt = "SELECT o.orders_id, op.products_id as pid, op.orders_products_id, op.products_name as pname, sum(op.products_quantity) as pquant, sum(op.final_price * op.products_quantity) as psum, op.products_tax as ptax FROM " . $oostable['orders'] . " o, " . $oostable['orders_products'] . " op WHERE o.orders_id = op.orders_id";
|
||||
|
||||
// query for attributes
|
||||
$this->queryAttr = "SELECT count(op.products_id) as attr_cnt, o.orders_id, opa.orders_products_id, opa.products_options, opa.products_options_values, opa.options_values_price, opa.price_prefix FROM " . $oostable['orders_products_attributes'] . " opa, " . $oostable['orders'] . " o, " . $oostable['orders_products'] . " op WHERE o.orders_id = opa.orders_id AND op.orders_products_id = opa.orders_products_id";
|
||||
|
||||
// query for shipping
|
||||
$this->queryShipping = "SELECT sum(ot.value) as shipping FROM " . $oostable['orders'] . " o, " . $oostable['orders_total'] . " ot WHERE ot.orders_id = o.orders_id AND ot.class = 'ot_shipping'";
|
||||
|
||||
switch ($sort) {
|
||||
case '0':
|
||||
$this->sortString = "";
|
||||
break;
|
||||
case '1':
|
||||
$this->sortString = " ORDER BY pname ASC ";
|
||||
break;
|
||||
case '2':
|
||||
$this->sortString = " ORDER BY pname DESC";
|
||||
break;
|
||||
case '3':
|
||||
$this->sortString = " ORDER BY pquant ASC, pname ASC";
|
||||
break;
|
||||
case '4':
|
||||
$this->sortString = " ORDER BY pquant DESC, pname ASC";
|
||||
break;
|
||||
case '5':
|
||||
$this->sortString = " ORDER BY psum ASC, pname ASC";
|
||||
break;
|
||||
case '6':
|
||||
$this->sortString = " ORDER BY psum DESC, pname ASC";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getNext() {
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$oostable =& oosDBGetTables();
|
||||
|
||||
switch ($this->mode) {
|
||||
// yearly
|
||||
case '1':
|
||||
$sd = $this->actDate;
|
||||
$ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd), date("Y", $sd) + 1);
|
||||
break;
|
||||
// monthly
|
||||
case '2':
|
||||
$sd = $this->actDate;
|
||||
$ed = mktime(0, 0, 0, date("m", $sd) + 1, 1, date("Y", $sd));
|
||||
break;
|
||||
// weekly
|
||||
case '3':
|
||||
$sd = $this->actDate;
|
||||
$ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd) + 7, date("Y", $sd));
|
||||
break;
|
||||
// daily
|
||||
case '4':
|
||||
$sd = $this->actDate;
|
||||
$ed = mktime(0, 0, 0, date("m", $sd), date("d", $sd) + 1, date("Y", $sd));
|
||||
break;
|
||||
}
|
||||
if ($ed > $this->endDate) {
|
||||
$ed = $this->endDate;
|
||||
}
|
||||
|
||||
$filterString = "";
|
||||
if ($this->statusFilter > 0) {
|
||||
$filterString .= " AND o.orders_status = " . $this->statusFilter . " ";
|
||||
}
|
||||
$rqOrders = $dbconn->Execute($this->queryOrderCnt . " WHERE o.date_purchased >= '" . oos_db_input(date("Y-m-d\TH:i:s", $sd)) . "' AND o.date_purchased < '" . oos_db_input(date("Y-m-d\TH:i:s", $ed)) . "'" . $filterString);
|
||||
$order = $rqOrders->fields;
|
||||
|
||||
$rqShipping = $dbconn->Execute($this->queryShipping . " AND o.date_purchased >= '" . oos_db_input(date("Y-m-d\TH:i:s", $sd)) . "' AND o.date_purchased < '" . oos_db_input(date("Y-m-d\TH:i:s", $ed)) . "'" . $filterString);
|
||||
$shipping = $rqShipping->fields;
|
||||
|
||||
$rqItems = $dbconn->Execute($this->queryItemCnt . " AND o.date_purchased >= '" . oos_db_input(date("Y-m-d\TH:i:s", $sd)) . "' AND o.date_purchased < '" . oos_db_input(date("Y-m-d\TH:i:s", $ed)) . "'" . $filterString . " group by pid " . $this->sortString);
|
||||
|
||||
// set the return values
|
||||
$this->actDate = $ed;
|
||||
$this->showDate = $sd;
|
||||
$this->showDateEnd = $ed - 60 * 60 * 24;
|
||||
|
||||
// execute the query
|
||||
$cnt = 0;
|
||||
$itemTot = 0;
|
||||
$sumTot = 0;
|
||||
while ($resp[$cnt] = $rqItems->fields) {
|
||||
// to avoid rounding differences round for every quantum
|
||||
// multiply with the number of items afterwords.
|
||||
$price = $resp[$cnt]['psum'] / $resp[$cnt]['pquant'];
|
||||
|
||||
// products_attributes
|
||||
// are there any attributes for this order_id ?
|
||||
$rqAttr = $dbconn->Execute($this->queryAttr . " AND o.date_purchased >= '" . oos_db_input(date("Y-m-d\TH:i:s", $sd)) . "' AND o.date_purchased < '" . oos_db_input(date("Y-m-d\TH:i:s", $ed)) . "' AND op.products_id = " . $resp[$cnt]['pid'] . $filterString . " group by products_options_values ORDER BY orders_products_id");
|
||||
$i = 0;
|
||||
while ($attr[$i] = $rqAttr->fields) {
|
||||
$i++;
|
||||
// Move that ADOdb pointer!
|
||||
$rqAttr->MoveNext();
|
||||
}
|
||||
|
||||
// values per date
|
||||
if ($i > 0) {
|
||||
$price2 = 0;
|
||||
$price3 = 0;
|
||||
$option = array();
|
||||
$k = -1;
|
||||
$ord_pro_id_old = 0;
|
||||
for ($j = 0; $j < $i; $j++) {
|
||||
if ($attr[$j]['price_prefix'] == "-") {
|
||||
$price2 += (-1) * $attr[$j]['options_values_price'];
|
||||
$price3 = (-1) * $attr[$j]['options_values_price'];
|
||||
$prefix = "-";
|
||||
} else {
|
||||
$price2 += $attr[$j]['options_values_price'];
|
||||
$price3 = $attr[$j]['options_values_price'];
|
||||
$prefix = "+";
|
||||
}
|
||||
$ord_pro_id = $attr[$j]['orders_products_id'];
|
||||
if ( $ord_pro_id != $ord_pro_id_old) {
|
||||
$k++;
|
||||
$l = 0;
|
||||
// set values
|
||||
$option[$k]['quant'] = $attr[$j]['attr_cnt'];
|
||||
$option[$k]['options'][0] = $attr[$j]['products_options'];
|
||||
$option[$k]['options_values'][0] = $attr[$j]['products_options_values'];
|
||||
if ($price3 != 0) {
|
||||
$option[$k]['price'][0] = oos_add_tax($price3, $resp[$cnt]['ptax']);
|
||||
} else {
|
||||
$option[$k]['price'][0] = 0;
|
||||
}
|
||||
} else {
|
||||
$l++;
|
||||
// update values
|
||||
$option[$k]['options'][$l] = $attr[$j]['products_options'];
|
||||
$option[$k]['options_values'][$l] = $attr[$j]['products_options_values'];
|
||||
if ($price3 != 0) {
|
||||
$option[$k]['price'][$l] = oos_add_tax($price3, $resp[$cnt]['ptax']);
|
||||
} else {
|
||||
$option[$k]['price'][$l] = 0;
|
||||
}
|
||||
}
|
||||
$ord_pro_id_old = $ord_pro_id;
|
||||
}
|
||||
// set attr value
|
||||
$resp[$cnt]['attr'] = $option;
|
||||
} else {
|
||||
$resp[$cnt]['attr'] = "";
|
||||
}
|
||||
$resp[$cnt]['price'] = oos_add_tax($price, $resp[$cnt]['ptax']);
|
||||
$resp[$cnt]['psum'] = $resp[$cnt]['pquant'] * oos_add_tax($price, $resp[$cnt]['ptax']);
|
||||
$resp[$cnt]['order'] = $order['order_cnt'];
|
||||
$resp[$cnt]['shipping'] = $shipping['shipping'];
|
||||
|
||||
// values per date and item
|
||||
$sumTot += $resp[$cnt]['psum'];
|
||||
$itemTot += $resp[$cnt]['pquant'];
|
||||
// add totsum and totitem until current row
|
||||
$resp[$cnt]['totsum'] = $sumTot;
|
||||
$resp[$cnt]['totitem'] = $itemTot;
|
||||
$cnt++;
|
||||
|
||||
// Move that ADOdb pointer!
|
||||
$rqItems->MoveNext();
|
||||
}
|
||||
|
||||
return $resp;
|
||||
|
||||
}
|
||||
}
|
||||
|
137
msd2/myoos/admin/includes/classes/class_split_page_results.php
Normal file
137
msd2/myoos/admin/includes/classes/class_split_page_results.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: split_page_results.php,v 1.11 2002/11/11 21:12:19 hpdl
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
|
||||
class splitPageResults {
|
||||
|
||||
public function __construct(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows) {
|
||||
|
||||
|
||||
if ($max_rows_per_page == 0) $max_rows_per_page = 20;
|
||||
$sql_query = preg_replace("/\n\r|\r\n|\n|\r/", " ", $sql_query);
|
||||
|
||||
if (empty($current_page_number)) $current_page_number = 1;
|
||||
$current_page_number = (int)$current_page_number;
|
||||
|
||||
$pos_to = strlen($sql_query);
|
||||
$pos_from = strpos($sql_query, ' FROM', 0);
|
||||
|
||||
$pos_group_by = strpos($sql_query, ' GROUP BY', $pos_from);
|
||||
if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by;
|
||||
|
||||
$pos_having = strpos($sql_query, ' HAVING', $pos_from);
|
||||
if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having;
|
||||
|
||||
$pos_order_by = strpos($sql_query, ' ORDER BY', $pos_from);
|
||||
if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by;
|
||||
|
||||
$sql = "SELECT count(*) AS total " . substr($sql_query, $pos_from, ($pos_to - $pos_from));
|
||||
|
||||
// Get database information
|
||||
$dbconn =& oosDBGetConn();
|
||||
$reviews_count = $dbconn->Execute($sql);
|
||||
$query_num_rows = $reviews_count->fields['total'];
|
||||
|
||||
$num_pages = ceil($query_num_rows / $max_rows_per_page);
|
||||
if ($current_page_number > $num_pages) {
|
||||
$current_page_number = $num_pages;
|
||||
}
|
||||
$offset = ($max_rows_per_page * ($current_page_number - 1));
|
||||
$sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;
|
||||
}
|
||||
|
||||
|
||||
public function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '', $page_name = 'page') {
|
||||
GLOBAL $session;
|
||||
|
||||
if ( oos_is_not_null($parameters) && (substr($parameters, -1) != '&') ) $parameters .= '&';
|
||||
|
||||
// calculate number of pages needing links
|
||||
$num_pages = intval($query_numrows / $max_rows_per_page);
|
||||
|
||||
// $num_pages now contains int of pages needed unless there is a remainder from division
|
||||
if ($query_numrows % $max_rows_per_page) $num_pages++; // has remainder so add one page
|
||||
|
||||
$pages_array = array();
|
||||
for ($i=1; $i<=$num_pages; $i++) {
|
||||
$pages_array[] = array('id' => $i, 'text' => $i);
|
||||
}
|
||||
|
||||
if ($num_pages > 1) {
|
||||
$display_links = oos_draw_form('id', 'pages', basename($_SERVER['PHP_SELF']), '', 'get', FALSE);
|
||||
|
||||
if ($current_page_number > 1) {
|
||||
$display_links .= '<a href="' . oos_href_link_admin(basename($_SERVER['PHP_SELF']), $parameters . $page_name . '=' . ($current_page_number - 1)) . '" class="splitPageLink">' . PREVNEXT_BUTTON_PREV . '</a> ';
|
||||
} else {
|
||||
$display_links .= PREVNEXT_BUTTON_PREV . ' ';
|
||||
}
|
||||
|
||||
$display_links .= sprintf(TEXT_RESULT_PAGE, oos_draw_pull_down_menu($page_name, $pages_array, '', 'onChange="this.form.submit();"'), $num_pages);
|
||||
|
||||
if (($current_page_number < $num_pages) && ($num_pages != 1)) {
|
||||
$display_links .= ' <a href="' . oos_href_link_admin(basename($_SERVER['PHP_SELF']), $parameters . $page_name . '=' . ($current_page_number + 1)) . '" class="splitPageLink">' . PREVNEXT_BUTTON_NEXT . '</a>';
|
||||
} else {
|
||||
$display_links .= ' ' . PREVNEXT_BUTTON_NEXT;
|
||||
}
|
||||
|
||||
if ($parameters != '') {
|
||||
if (substr($parameters, -1) == '&') $parameters = substr($parameters, 0, -1);
|
||||
$pairs = explode('&', $parameters);
|
||||
foreach($pairs as $pair) {
|
||||
list($key,$value) = explode('=', $pair);
|
||||
$display_links .= oos_draw_hidden_field(rawurldecode($key), rawurldecode($value));
|
||||
}
|
||||
}
|
||||
|
||||
if (SID) $display_links .= oos_draw_hidden_field($session->getName(), $session->getId());
|
||||
|
||||
$display_links .= '</form>';
|
||||
} else {
|
||||
$display_links = sprintf(TEXT_RESULT_PAGE, $num_pages, $num_pages);
|
||||
}
|
||||
|
||||
return $display_links;
|
||||
}
|
||||
|
||||
|
||||
public function display_count($query_numrows, $max_rows_per_page, $current_page_number, $text_output) {
|
||||
|
||||
if (empty($current_page_number)) $current_page_number = 1;
|
||||
$current_page_number = (int)$current_page_number;
|
||||
|
||||
if ($max_rows_per_page == 0) $max_rows_per_page = 20;
|
||||
if ($max_rows_per_page == '') $max_rows_per_page = $query_numrows;
|
||||
|
||||
$to_num = ($max_rows_per_page * $current_page_number);
|
||||
if ($to_num > $query_numrows) $to_num = $query_numrows;
|
||||
$from_num = ($max_rows_per_page * ($current_page_number - 1));
|
||||
if ($to_num == 0) {
|
||||
$from_num = 0;
|
||||
} else {
|
||||
$from_num++;
|
||||
}
|
||||
|
||||
return sprintf($text_output, $from_num, $to_num, $query_numrows);
|
||||
}
|
||||
}
|
||||
|
119
msd2/myoos/admin/includes/classes/class_table_block.php
Normal file
119
msd2/myoos/admin/includes/classes/class_table_block.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
$Id: class_table_block.php,v 1.1 2007/06/08 14:58:10 r23 Exp $
|
||||
|
||||
MyOOS [Shopsystem]
|
||||
https://www.oos-shop.de
|
||||
|
||||
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
File: table_block.php,v 1.2 2002/11/22 18:45:46 dgw_
|
||||
----------------------------------------------------------------------
|
||||
osCommerce, Open Source E-Commerce Solutions
|
||||
http://www.oscommerce.com
|
||||
|
||||
Copyright (c) 2003 osCommerce
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/** ensure this file is being included by a parent file */
|
||||
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
class tableBlock {
|
||||
var $table_border = '0';
|
||||
var $table_width = '100%';
|
||||
var $table_cellspacing = '0';
|
||||
var $table_cellpadding = '2';
|
||||
var $table_parameters = '';
|
||||
var $table_row_parameters = '';
|
||||
var $table_data_parameters = '';
|
||||
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
function tableThead($contents) {
|
||||
$sTableBox = '';
|
||||
|
||||
$form_set = FALSE;
|
||||
|
||||
for ($i = 0, $n = count($contents); $i < $n; $i++) {
|
||||
$sTableBox .= ' <tr';
|
||||
if (oos_is_not_null($this->table_row_parameters)) $sTableBox .= ' ' . $this->table_row_parameters;
|
||||
if (isset($contents[$i]['params']) && oos_is_not_null($contents[$i]['params'])) $sTableBox .= ' ' . $contents[$i]['params'];
|
||||
$sTableBox .= '>' . "\n";
|
||||
|
||||
$sTableBox .= ' <th';
|
||||
if (isset($contents[$i]['align']) && oos_is_not_null($contents[$i]['align'])) $sTableBox .= ' align="' . $contents[$i]['align'] . '"';
|
||||
if (isset($contents[$i]['params']) && oos_is_not_null($contents[$i]['params'])) {
|
||||
$sTableBox .= ' ' . $contents[$i]['params'];
|
||||
} elseif (oos_is_not_null($this->table_data_parameters)) {
|
||||
$sTableBox .= ' ' . $this->table_data_parameters;
|
||||
}
|
||||
$sTableBox .= '>' . $contents[$i]['text'] . '</th>' . "\n";
|
||||
|
||||
|
||||
$sTableBox .= ' </tr>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
return $sTableBox;
|
||||
}
|
||||
|
||||
|
||||
function tableBlock($contents) {
|
||||
$sTableBox = '';
|
||||
|
||||
$form_set = FALSE;
|
||||
if (isset($contents['form'])) {
|
||||
$sTableBox .= $contents['form'] . "\n";
|
||||
$form_set = TRUE;
|
||||
array_shift($contents);
|
||||
}
|
||||
|
||||
|
||||
for ($i = 0, $n = count($contents); $i < $n; $i++) {
|
||||
$sTableBox .= ' <tr';
|
||||
if (oos_is_not_null($this->table_row_parameters)) $sTableBox .= ' ' . $this->table_row_parameters;
|
||||
if (isset($contents[$i]['params']) && oos_is_not_null($contents[$i]['params'])) $sTableBox .= ' ' . $contents[$i]['params'];
|
||||
$sTableBox .= '>' . "\n";
|
||||
|
||||
if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
|
||||
for ($x = 0, $y = count($contents[$i]); $x < $y; $x++) {
|
||||
if (isset($contents[$i][$x]['text']) && oos_is_not_null($contents[$i][$x]['text'])) {
|
||||
$sTableBox .= ' <td';
|
||||
if (isset($contents[$i][$x]['align']) && oos_is_not_null($contents[$i][$x]['align'])) $sTableBox .= ' align="' . $contents[$i][$x]['align'] . '"';
|
||||
if (isset($contents[$i][$x]['params']) && oos_is_not_null($contents[$i][$x]['params'])) {
|
||||
$sTableBox .= ' ' . $contents[$i][$x]['params'];
|
||||
} elseif (oos_is_not_null($this->table_data_parameters)) {
|
||||
$sTableBox .= ' ' . $this->table_data_parameters;
|
||||
}
|
||||
$sTableBox .= '>';
|
||||
if (isset($contents[$i][$x]['form']) && oos_is_not_null($contents[$i][$x]['form'])) $sTableBox .= $contents[$i][$x]['form'];
|
||||
$sTableBox .= $contents[$i][$x]['text'];
|
||||
if (isset($contents[$i][$x]['form']) && oos_is_not_null($contents[$i][$x]['form'])) $sTableBox .= '</form>';
|
||||
$sTableBox .= '</td>' . "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sTableBox .= ' <td';
|
||||
if (isset($contents[$i]['align']) && oos_is_not_null($contents[$i]['align'])) $sTableBox .= ' align="' . $contents[$i]['align'] . '"';
|
||||
if (isset($contents[$i]['params']) && oos_is_not_null($contents[$i]['params'])) {
|
||||
$sTableBox .= ' ' . $contents[$i]['params'];
|
||||
} elseif (oos_is_not_null($this->table_data_parameters)) {
|
||||
$sTableBox .= ' ' . $this->table_data_parameters;
|
||||
}
|
||||
$sTableBox .= '>' . $contents[$i]['text'] . '</td>' . "\n";
|
||||
}
|
||||
|
||||
$sTableBox .= ' </tr>' . "\n";
|
||||
}
|
||||
|
||||
if ($form_set == TRUE) $sTableBox .= '</form>' . "\n";
|
||||
|
||||
return $sTableBox;
|
||||
}
|
||||
}
|
||||
|
1370
msd2/myoos/admin/includes/classes/class_upload.php
Normal file
1370
msd2/myoos/admin/includes/classes/class_upload.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user