/**
 * dispatchedOrders
 *
 * @return Ambigous <string, multitype:NULL >
 */
function dispatchedOrders()
{
    global $db;
    $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur';
    $resql = $db->query($sql);
    $res = array();
    if ($resql && $db->num_rows($resql) > 0) {
        while ($obj = $db->fetch_object($resql)) {
            if (dispatched($obj->rowid)) {
                $res[] = $obj->rowid;
            }
        }
    }
    if ($res) {
        $res = '(' . implode(',', $res) . ')';
    } else {
        //hack to make sure ordered SQL request won't syntax error
        $res = '(0)';
    }
    return $res;
}
 print_liste_field_titre($langs->trans('Company'), $_SERVER['PHP_SELF'], 's.nom', '', '', '', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('Author'), $_SERVER['PHP_SELF'], 'u.login', '', '', '', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('AmountTTC'), $_SERVER['PHP_SELF'], 'cf.total_ttc', '', '', '', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('OrderCreation'), $_SERVER['PHP_SELF'], 'cf.date_creation', '', '', '', $sortfield, $sortorder);
 print_liste_field_titre($langs->trans('Status'), $_SERVER['PHP_SELF'], 'cf.fk_statut', '', '', 'align="right"', $sortfield, $sortorder);
 $form = new Form($db);
 print '</tr>' . '<tr class="liste_titre">' . '<td class="liste_titre">' . '<input type="text" class="flat" name="search_ref" value="' . $sref . '">' . '</td>' . '<td class="liste_titre">' . '<input type="text" class="flat" name="search_nom" value="' . $snom . '">' . '</td>' . '<td class="liste_titre">' . '<input type="text" class="flat" name="search_user" value="' . $suser . '">' . '</td>' . '<td class="liste_titre">' . '<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">' . '</td>' . '<td class="liste_titre">' . $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, '') . '</td>' . '<td class="liste_titre" align="right">';
 $src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png';
 $value = dol_escape_htmltag($langs->trans('Search'));
 print '<input type="image" class="liste_titre" name="button_search" src="' . $src . '" value="' . $value . '" title="' . $value . '">' . '</td>' . '</tr>';
 $var = true;
 $userstatic = new User($db);
 while ($i < min($num, $conf->liste_limit)) {
     $obj = $db->fetch_object($resql);
     $var = !$var;
     if (!dispatched($obj->rowid) && (!$sproduct || in_array($sproduct, getProducts($obj->rowid)))) {
         $href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
         print '<tr ' . $bc[$var] . '>' . '<td>' . '<a href="' . $href . '">' . img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref . '</a></td>';
         // Company
         $href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid;
         print '<td>' . '<a href="' . $href . '">' . img_object($langs->trans('ShowCompany'), 'company') . ' ' . $obj->nom . '</a></td>';
         // Author
         $userstatic->id = $obj->fk_user_author;
         $userstatic->login = $obj->login;
         if ($userstatic->id) {
             $txt = $userstatic->getLoginUrl(1);
         } else {
             $txt = '&nbsp;';
         }
         print '<td>' . $txt . '</td>' . '<td>' . price($obj->total_ttc) . '</td>';
         // Date