예제 #1
0
 function get_links($invoiceID)
 {
     $rows = invoiceEntity::get("invoice", $invoiceID);
     // cheating :)
     foreach ($rows as $row) {
         if ($row["timeSheetID"]) {
             $timeSheet = new timeSheet($row["timeSheetID"]);
             $timeSheet_links[] = $timeSheet->get_link();
         }
         if ($row["expenseFormID"]) {
             $expenseForm = new expenseForm($row["expenseFormID"]);
             $expenseForm_links[] = $expenseForm->get_link();
         }
         if ($row["productSaleID"]) {
             $productSale = new productSale($row["productSaleID"]);
             $productSale_links[] = $productSale->get_link();
         }
     }
     $timeSheet_links and $rtn[] = "Time Sheet: " . implode(", ", (array) $timeSheet_links);
     $expenseForm_links and $rtn[] = "Expense Form: " . implode(", ", (array) $expenseForm_links);
     $productSale_links and $rtn[] = "Product Sale: " . implode(", ", (array) $productSale_links);
     return implode(" / ", (array) $rtn);
 }
예제 #2
0
 public static function get_list($_FORM = array())
 {
     $filter = productSale::get_list_filter($_FORM);
     $debug = $_FORM["debug"];
     $debug and print "\n<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
     $debug and print "\n<pre>filter: " . print_r($filter, 1) . "</pre>";
     if (is_array($filter) && count($filter)) {
         $f = " WHERE " . implode(" AND ", $filter);
     }
     $f .= " ORDER BY IFNULL(productSaleDate,productSaleCreatedTime)";
     $db = new db_alloc();
     $query = prepare("SELECT productSale.*, project.projectName, client.clientName\n                        FROM productSale \n                   LEFT JOIN client ON productSale.clientID = client.clientID\n                   LEFT JOIN project ON productSale.projectID = project.projectID\n                    " . $f);
     $db->query($query);
     $statii = productSale::get_statii();
     $people =& get_cached_table("person");
     $rows = array();
     while ($row = $db->next_record()) {
         $productSale = new productSale();
         $productSale->read_db_record($db);
         $row["amounts"] = $productSale->get_amounts();
         $row["statusLabel"] = $statii[$row["status"]];
         $row["salespersonLabel"] = $people[$row["personID"]]["name"];
         $row["creatorLabel"] = $people[$row["productSaleCreatedUser"]]["name"];
         $row["productSaleLink"] = $productSale->get_link();
         $rows[] = $row;
     }
     return (array) $rows;
 }