Witam
Proszę o pomoc - w poniższej funkcji potrzebuję wstawić warunek gdzie:
WHERE cash.customerid = ? AND cash.time <= aktualna data(UNIX)
function GetCustomerBalanceListUserpanel($id, $totime = NULL, $direction = 'ASC') {
($direction == 'ASC' || $direction == 'asc') ? $direction == 'ASC' : $direction == 'DESC';
$saldolist = array();
if ($tslist = $this->DB->GetAll('SELECT cash.id AS id, time, cash.type AS type,
cash.value AS value, taxes.label AS tax, cash.customerid AS customerid,
comment, docid, users.name AS username,
documents.type AS doctype, documents.closed AS closed ,
documents.number AS docnumber, documents.cdate AS docdate,
numberplans.template AS doctemplate, documents.extnumber AS docextnumber,
documents.fullnumber, documents.paytime
FROM cash
LEFT JOIN users ON users.id = cash.userid
LEFT JOIN documents ON documents.id = docid
LEFT JOIN taxes ON cash.taxid = taxes.id
LEFT JOIN numberplans ON (numberplans.id = documents.numberplanid)
WHERE cash.customerid = ? AND cash.time <= '
. ($totime ? ' AND time <= ' . intval($totime) : '')
. ' ORDER BY time ' . $direction, array($id)))
{
$saldolist['balance'] = 0;
$saldolist['total'] = 0;
$i = 0;
foreach ($tslist as $row) {
// old format wrapper
foreach ($row as $column => $value)
$saldolist[$column][$i] = $value;
$saldolist['after'][$i] = round($saldolist['balance'] + $row['value'], 2);
$saldolist['balance'] += $row['value'];
$saldolist['date'][$i] = date('Y/m/d', $row['time']);
$saldolist['pdate'][$i] = $row['time'] + ($row['paytime'] * 86400);
$i++;
}
$saldolist['total'] = sizeof($tslist);
}
$saldolist['customerid'] = $id;
return $saldolist;
}
.................. pozdrawiam
MB
uczestnicy (1)
-
Michał Bochniak