Пример #1
0
 public function check_reorder_level()
 {
     global $db;
     global $auth_session;
     $domain_id = domain_id::get($this->domain_id);
     //sellect qty and reorder level
     $inventory = new product();
     $sth = $inventory->select_all('count');
     $inventory_all = $sth->fetchAll(PDO::FETCH_ASSOC);
     $email = "";
     foreach ($inventory_all as $row) {
         if ($row['quantity'] <= $row['reorder_level']) {
             $message = "The quantity of Product: " . $row['description'] . " is " . siLocal::number($row['quantity']) . ", which is equal to or below its reorder level of " . $row['reorder_level'];
             $return['row_' . $row['id']]['message'] = $message;
             $email_message .= $message . "<br />\n";
         }
     }
     //print_r($return);
     #$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
     $email = new email();
     $email->notes = $email_message;
     $email->from = $email->get_admin_email();
     $email->to = $email->get_admin_email();
     #$email -> bcc = "justin@localhost";
     $email->subject = "Simple Invoices reorder level email";
     $email->send();
     return $return;
 }
Пример #2
0
<?php

header("Content-type: text/xml");
//$start = (isset($_POST['start'])) ? $_POST['start'] : "0" ;
$dir = isset($_POST['sortorder']) ? $_POST['sortorder'] : "ASC";
$sort = isset($_POST['sortname']) ? $_POST['sortname'] : "description";
$rp = isset($_POST['rp']) ? $_POST['rp'] : "25";
$page = isset($_POST['page']) ? $_POST['page'] : "1";
$defaults = getSystemDefaults();
$smarty->assign("defaults", $defaults);
$products = new product();
$sth = $products->select_all('', $dir, $sort, $rp, $page);
$sth_count_rows = $products->select_all('count', $dir, $sort, $rp, $page);
$products_all = $sth->fetchAll(PDO::FETCH_ASSOC);
$count = $sth_count_rows->rowCount();
//echo sql2xml($customers, $count);
$xml .= "<rows>";
$xml .= "<page>{$page}</page>";
$xml .= "<total>{$count}</total>";
foreach ($products_all as $row) {
    $xml .= "<row id='" . $row['iso'] . "'>";
    $xml .= "<cell><![CDATA[\r\n\t\t\t<a class='index_table' title='{$LANG['view']} " . $row['description'] . "' href='index.php?module=products&view=details&id=" . $row['id'] . "&action=view'><img src='images/common/view.png' height='16' border='-5px' padding='-4px' valign='bottom' /></a>\r\n\t\t\t<a class='index_table' title='{$LANG['edit']} " . $row['description'] . "' href='index.php?module=products&view=details&id=" . $row['id'] . "&action=edit'><img src='images/common/edit.png' height='16' border='-5px' padding='-4px' valign='bottom' /></a>\r\n\t\t]]></cell>";
    $xml .= "<cell><![CDATA[" . $row['description'] . "]]></cell>";
    $xml .= "<cell><![CDATA[" . siLocal::number_clean($row['unit_price']) . "]]></cell>";
    if ($defaults['inventory'] == '1') {
        $xml .= "<cell><![CDATA[" . siLocal::number_trim($row['quantity']) . "]]></cell>";
    }
    if ($row['enabled'] == $LANG['enabled']) {
        $xml .= "<cell><![CDATA[<img src='images/common/tick.png' alt='" . $row['enabled'] . "' title='" . $row['enabled'] . "' />]]></cell>";
    } else {
        $xml .= "<cell><![CDATA[<img src='images/common/cross.png' alt='" . $row['enabled'] . "' title='" . $row['enabled'] . "' />]]></cell>";