Beispiel #1
0
<?php

include '../../../config.php';
include $FANNIE_ROOT . 'classlib2.0/FannieAPI.php';
if (!class_exists("SQLManager")) {
    require_once $FANNIE_ROOT . "src/SQLManager.php";
}
include '../../db.php';
if (isset($_GET['excel'])) {
    header('Content-Type: application/ms-excel');
    header('Content-Disposition: attachment; filename="inactivationsStock.xls"');
    $_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'];
}
$cached_output = \COREPOS\Fannie\API\data\DataCache::getFile("monthly");
if ($cached_output) {
    echo $cached_output;
    return;
}
ob_start();
$query = "select m.card_no,CONCAT(c.FirstName,' ',c.LastName),m.start_date,\n    DATE_ADD(m.start_date,INTERVAL 2 YEAR) as endDate,\n    s.stockPurchase,s.tdate,n.payments\n    from memDates as m left join\n    custdata as c on c.CardNo=m.card_no and c.personNum=1\n    left join is4c_trans.stockpurchases as s on m.card_no=s.card_no\n    left join is4c_trans.equity_live_balance as n on m.card_no=n.memnum\n    where " . $sql->monthdiff($sql->now(), 'DATE_ADD(m.start_date,INTERVAL 2 YEAR)') . " = -1\n    and c.Type='PC' and n.payments < 100\n    order by m.card_no,s.tdate";
echo "<table border=1 cellpadding=0 cellspacing=0>\n";
$headers = array('Mem Num', 'Name', 'Opening Date', 'Ending Date', 'First Buy Ammount', 'Last Buy Date', 'Total Equity');
echo "<tr>";
foreach ($headers as $h) {
    echo "<th width=120><font size=2>{$h}</font></th>";
}
echo "</tr>";
function printLine($lastrow, $b)
{
    $backgrounds = array('#ffffcc', '#ffffff');
    echo "<tr>";
Beispiel #2
0
$monthMinus = 1;
if (isset($_GET["monthMinus"])) {
    $monthMinus = $_GET["monthMinus"];
}
$stamp = strtotime("-{$monthMinus} month");
echo strtoupper(date("F", $stamp));
echo " ";
echo date("Y", $stamp);
$dlog = "is4c_trans.dlog_90_view";
$dlog = "trans_archive.dlogBig";
echo " NABS</b><br />";
if (!isset($_GET["excel"])) {
    echo "<a href=index.php?excel=xls&monthMinus={$monthMinus}>Save to Excel</a>";
}
echo "<p />";
$output = \COREPOS\Fannie\API\data\DataCache::getFile('monthly');
if (!$output) {
    ob_start();
    $start = date("Y-m-01", $stamp);
    $end = date("Y-m-t", $stamp);
    $span = array("{$start} 00:00:00", "{$end} 23:59:59");
    $accounts = array();
    $accountQ = $dbc->prepare_statement("SELECT CardNo from custdata WHERE memType=4 ORDER BY CardNo");
    $accountR = $dbc->exec_statement($accountQ);
    while ($accountW = $dbc->fetch_row($accountR)) {
        $accounts[] = $accountW['CardNo'];
    }
    $accountStr = "(";
    $args = array();
    foreach ($accounts as $a) {
        $accountStr .= "?,";
Beispiel #3
0
 function get_startDate_endDate_view()
 {
     global $FANNIE_URL, $FANNIE_ROOT;
     $records = \COREPOS\Fannie\API\data\DataCache::getFile('daily');
     if ($records !== False) {
         $records = unserialize($records);
     }
     if (!is_array($records) || FormLib::get('no-cache') == '1') {
         $records = $this->get_data();
         \COREPOS\Fannie\API\data\DataCache::putFile('daily', serialize($records));
     }
     $ret = '';
     $debit = $credit = 0.0;
     if (FormLib::get_form_value('excel', '') === '') {
         $ret .= sprintf('<a href="OverShortMAS.php?startDate=%s&endDate=%s&excel=yes">Download</a>', $this->startDate, $this->endDate);
         $ret .= '<table class="table table-bordered small">';
         foreach ($records as $r) {
             if (preg_match('/\\(\\d+-\\d+-\\d+ \\d+-\\d+-\\d+\\)/', $r[5])) {
                 $tmp = explode(' ', $r[5]);
                 $date = trim($tmp[count($tmp) - 2], '()');
                 $trans = trim($tmp[count($tmp) - 1], '()');
                 $r[5] = sprintf('<a href="%sadmin/LookupReceipt/RenderReceiptPage.php?receipt=%s&date=%s">%s</a>', $FANNIE_URL, $trans, $date, $r[5]);
             }
             $ret .= sprintf('<tr><td>%d</td><td>%s</td><td>%s</td>
                     <td>%.2f</td><td>%.2f</td><td>%s</td></tr>', $r[0], $r[1], $r[2], $r[3], $r[4], $r[5]);
             $debit += $r[3];
             $credit += $r[4];
         }
         $ret .= sprintf('<tr><td colspan="3">Sum</td><td>%.2f</td><td>%.2f</td><td>&nbsp;</td></tr>', $debit, $credit);
         $ret .= '</table>';
     } else {
         foreach ($records as $row) {
             $line = '';
             foreach ($row as $val) {
                 $line .= strstr($val, ',') ? '"' . $val . '"' : $val;
                 $line .= ',';
             }
             $line = substr($line, 0, strlen($line) - 1) . "\r\n";
             $ret .= $line;
         }
     }
     return $ret;
 }