/**
  *  Load data into info_box_contents array to show array later.
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $conf, $user, $langs, $db;
     $langs->load("boxes");
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
     $supplierorderstatic = new CommandeFournisseur($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLatestSupplierOrders", $max));
     if ($user->rights->fournisseur->commande->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " c.ref, c.tms, c.rowid,";
         $sql .= " c.fk_statut";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         $sql .= ", " . MAIN_DB_PREFIX . "commande_fournisseur as c";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE c.fk_soc = s.rowid";
         $sql .= " AND c.entity = " . $conf->entity;
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
         }
         $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $datem = $db->jdate($objp->tms);
                 $urlo = DOL_URL_ROOT . "/fourn/commande/fiche.php?id=" . $objp->rowid;
                 $urls = DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid;
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => $urlo);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref, 'url' => $urlo);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => $urls);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => $urls);
                 $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datem, 'day'));
                 $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $supplierorderstatic->LibStatut($objp->fk_statut, 3));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoSupplierOrder"));
             }
             $db->free($result);
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }
Пример #2
0
 /**
  *    Return combo list of differents status of a orders
  *
  *    @param	string	$selected   Preselected value
  *    @param	int		$short		Use short labels
  *    @param	string	$hmlname	Name of HTML select element
  *    @return	void
  */
 function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status')
 {
     print '<select class="flat" name="' . $hmlname . '">';
     print '<option value="-1">&nbsp;</option>';
     $statustohow = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6,7', '9' => '9');
     // 7 is same label than 6. 8 does not exists (billed is another field)
     foreach ($statustohow as $key => $value) {
         print '<option value="' . $value . '"' . ($selected == $key || $selected == $value ? ' selected' : '') . '>';
         print CommandeFournisseur::LibStatut($key, $short);
         print '</option>';
     }
     print '</select>';
 }
Пример #3
0
 /**
  *    Return combo list of differents status of a orders
  *
  *    @param	string	$selected   Preselected value
  *    @param	int		$short		Use short labels
  *    @param	string	$hmlname	Name of HTML select element
  *    @return	void
  */
 function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status')
 {
     print '<select class="flat" name="' . $hmlname . '">';
     print '<option value="-1">&nbsp;</option>';
     $statustohow = array(0, 1, 2, 3, 4, 5, 6, 9);
     // 7 is same label than 6. 8 does not exist.
     foreach ($statustohow as $key) {
         print '<option value="' . $key . '"' . ($selected == $key ? ' selected="selected"' : '') . '>';
         print CommandeFournisseur::LibStatut($key, $short);
         print '</option>';
     }
     print '</select>';
 }
 /**
  *    Return combo list of differents status of a orders
  *
  *    @param	array	$selected   Preselected values
  *    @param	string	$selected   Preselected value
  *    @param	int		$short		Use short labels
  *    @param	string	$hmlname	Name of HTML select element
  *    @return	void
  */
 function selectSupplierOrderStatus($selected = array(), $short = 0, $hmlname = 'order_status')
 {
     /*print '<select class="flat" name="'.$hmlname.'">';
             print '<option value="-1">&nbsp;</option>';
             $statustohow=array(0,1,2,3,4,5,6,9);	// 7 is same label than 6. 8 does not exist.
     
             foreach($statustohow as $key)
             {
     			print '<option value="'.$key.'"'.($selected == $key?' selected="selected"':'').'>';
     			print CommandeFournisseur::LibStatut($key,$short);
     	        print '</option>';
     	        */
     $statustohow = array(0, 1, 2, 3, 4, 5, 6, 9);
     // 7 is same label than 6. 8 does not exist.
     foreach ($statustohow as $key) {
         $stat = CommandeFournisseur::LibStatut($key, $short);
         print '<input name="statuts[]" type="checkbox"  value="' . $key . '"' . ($selected[$key] == $key ? ' selected="selected"' : '') . '>&nbsp;' . $stat . ' - ';
         print $key;
     }
 }
Пример #5
0
     $row = $db->fetch_row($resql);
     if ($row) {
         if ($row[1] != 7 && $row[1] != 6 && $row[1] != 5) {
             $vals[$row[1]] = $row[0];
             $totalinprocess += $row[0];
         }
         $total += $row[0];
     }
     $i++;
 }
 $db->free($resql);
 print '<table class="noborder nohover" width="100%">';
 print '<tr class="liste_titre"><td colspan="2">' . $langs->trans("Statistics") . ' - ' . $langs->trans("SuppliersOrders") . '</td></tr>';
 print "</tr>\n";
 foreach (array(0, 1, 2, 3, 4, 5, 6) as $statut) {
     $dataseries[] = array('label' => $commandestatic->LibStatut($statut, 1), 'data' => isset($vals[$statut]) ? (int) $vals[$statut] : 0);
     if (!$conf->use_javascript_ajax) {
         $var = !$var;
         print "<tr " . $bc[$var] . ">";
         print '<td>' . $commandestatic->LibStatut($statut, 0) . '</td>';
         print '<td align="right"><a href="list.php?statut=' . $statut . '">' . (isset($vals[$statut]) ? $vals[$statut] : 0) . '</a></td>';
         print "</tr>\n";
     }
 }
 if ($conf->use_javascript_ajax) {
     print '<tr class="impair"><td align="center" colspan="2">';
     $data = array('series' => $dataseries);
     dol_print_graph('stats', 300, 180, $data, 1, 'pie', 1, '', 0);
     print '</td></tr>';
 }
 //if ($totalinprocess != $total)
Пример #6
0
        // Amount with tax
        print '<td align="right" width="100">' . price($obj->total_ttc) . "</td>";
        // Date
        print "<td align=\"center\" width=\"100\">";
        if ($obj->dc) {
            print dol_print_date($db->jdate($obj->dc), "day");
        } else {
            print "-";
        }
        print '</td>';
        // Delivery date
        print '<td align="right">';
        print dol_print_date($db->jdate($obj->date_livraison), 'day');
        print '</td>';
        // Statut
        print '<td align="right">' . $commandestatic->LibStatut($obj->fk_statut, 5) . '</td>';
        // Billed
        print '<td align="center">' . yn($obj->billed) . '</td>';
        print '<td></td>';
        print "</tr>\n";
        $i++;
    }
    print "</table>\n";
    print "</form>\n";
    if (!empty($conf->facture->enable)) {
        print '<br>' . img_help(1, '') . ' ' . $langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")) . '<br>';
    }
    $db->free($resql);
} else {
    dol_print_error($db);
}
Пример #7
0
             print '</tr></table>';
             print '</td></tr>';
         }
         while ($i < $num && $i <= $MAXLIST) {
             $obj = $db->fetch_object($resql);
             $var = !$var;
             print "<tr {$bc[$var]}>";
             print '<td><a href="commande/fiche.php?id=' . $obj->rowid . '">' . img_object($langs->trans("ShowOrder"), "order") . " " . $obj->ref . '</a></td>';
             print '<td align="center" width="80">';
             if ($obj->dc) {
                 print dol_print_date($db->jdate($obj->dc), 'day');
             } else {
                 print "-";
             }
             print '</td>';
             print '<td align="right" nowrap="nowrap">' . $orderstatic->LibStatut($obj->fk_statut, 5) . '</td>';
             print '</tr>';
             $i++;
         }
         $db->free($resql);
         if ($num > 0) {
             print "</table>";
         }
     } else {
         dol_print_error($db);
     }
 }
 /*
  * Last invoices
  */
 $MAXLIST = 5;
Пример #8
0
$sql .= " GROUP BY cf.fk_statut";
$resql = $db->query($sql);
if ($resql) {
    $num = $db->num_rows($resql);
    $i = 0;
    print '<table class="noborder" width="100%">';
    print '<tr class="liste_titre"><td>' . $langs->trans("Orders") . '</td><td align="center">' . $langs->trans("Nb") . '</td><td>&nbsp;</td>';
    print "</tr>\n";
    $var = True;
    while ($i < $num) {
        $row = $db->fetch_row($resql);
        $var = !$var;
        print "<tr " . $bc[$var] . ">";
        print '<td>' . $langs->trans($commande->statuts[$row[1]]) . '</td>';
        print '<td align="center">' . $row[0] . '</td>';
        print '<td align="center"><a href="' . DOL_URL_ROOT . '/fourn/commande/list.php?statut=' . $row[1] . '">' . $commande->LibStatut($row[1], 3) . '</a></td>';
        print "</tr>\n";
        $i++;
    }
    print "</table>";
    print "<br>\n";
    $db->free($resql);
} else {
    dol_print_error($db);
}
// Draft orders
if (!empty($conf->fournisseur->enabled)) {
    $langs->load("orders");
    $sql = "SELECT cf.rowid, cf.ref, cf.total_ttc,";
    $sql .= " s.nom as name, s.rowid as socid";
    $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseur as cf";
Пример #9
0
            {
                $vals[$row[1]]=$row[0];
                $totalinprocess+=$row[0];
            }
            $total+=$row[0];
        }
        $i++;
    }
    $db->free($resql);

    print '<table class="noborder" width="100%">';
    print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'</td></tr>';
    print "</tr>\n";
    foreach (array(0,1,2,3,4,5,6) as $statut)
    {
        $dataseries[]=array('label'=>$commandestatic->LibStatut($statut,1),'values'=>array(0=>(isset($vals[$statut])?$vals[$statut]:0)));
        if (! $conf->use_javascript_ajax)
        {
            $var=!$var;
            print "<tr ".$bc[$var].">";
            print '<td>'.$commandestatic->LibStatut($statut,0).'</td>';
            print '<td align="right"><a href="liste.php?statut='.$statut.'">'.(isset($vals[$statut])?$vals[$statut]:0).'</a></td>';
            print "</tr>\n";
        }
    }
    if ($conf->use_javascript_ajax)
    {
        print '<tr><td align="center" colspan="2">';
        $data=array('series'=>$dataseries);
        dol_print_graph('stats',300,180,$data,1,'pie',1);
        print '</td></tr>';
Пример #10
0
     $filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
     $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $objp->rowid;
     print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
     print '</td></tr></table>';
     print '</td>';
     print '<td>' . $objp->ref_supplier . '</td>';
     // Order date
     print '<td align="center" nowrap>';
     print dol_print_date($db->jdate($objp->date_commande), 'day');
     print '</td>';
     // Delivery date
     print '<td align="center" nowrap>';
     print dol_print_date($db->jdate($objp->date_livraison), 'day');
     print '</td>';
     // Statut
     print '<td align="right" class="nowrap">' . $generic_commande->LibStatut($objp->fk_statut, 5) . '</td>';
     // Checkbox
     print '<td class="center">';
     print '<input class="flat checkformerge" type="checkbox" name="orders_to_invoice[]" value="' . $objp->rowid . '">';
     print '</td>';
     print '</tr>';
     $total = $total + $objp->price;
     $subtotal = $subtotal + $objp->price;
     $i++;
 }
 print '</table>';
 /*
  * Boutons actions
  */
 print '<div class="center">';
 print '<div class="right">';
Пример #11
0
                 '<td>'.
                 price($obj->total_ttc).
                 '</td>';

            // Date
            if ($obj->dc) {
                $date =  dol_print_date($db->jdate($obj->dc), 'dayhour');
            } else {
                $date =  '-';
            }
            print '<td>'.
                 $date.
                 '</td>'.
            // Statut
                 '<td align="right">'.
                 $commandestatic->LibStatut($obj->fk_statut, 5).
                 '</td>'.
                 '</tr>';
        }
        $i++;
    }
    print '</table>'.
         '</form>';

    $db->free($resql);

    dol_fiche_end();
}
else
{
	dol_print_error($db);
 /**
  *  Load data into info_box_contents array to show array later.
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 10)
 {
     global $conf, $user, $langs, $db;
     $langs->load("berrypro");
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
     $supplierorderstatic = new CommandeFournisseur($db);
     $url2 = "http://localhost/dolibarr37/htdocs/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3";
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLatest" . ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified") . "SupplierOrders", $max) . ' - <a href="' . $url2 . '" class="bold"> Ver m&aacute;s...</a>');
     if ($user->rights->fournisseur->commande->lire) {
         $sql = "SELECT s.nom as name, s.rowid as socid,";
         $sql .= " c.ref, c.tms, c.rowid, c.date_commande, c.date_livraison,";
         $sql .= " c.fk_statut";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         $sql .= ", " . MAIN_DB_PREFIX . "commande_fournisseur as c";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE c.fk_soc = s.rowid";
         $sql .= " AND c.entity = " . $conf->entity;
         $sql .= " AND c.fk_statut IN (3,4)";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
         }
         if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) {
             $sql .= " ORDER BY c.date_livraison DESC, c.ref DESC ";
         } else {
             $sql .= " ORDER BY c.date_livraison ASC, c.ref DESC ";
         }
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $date = $db->jdate($objp->date_commande);
                 $datel = $db->jdate($objp->date_livraison);
                 $datem = $db->jdate($objp->tms);
                 $urlo = DOL_URL_ROOT . "/fourn/commande/card.php?id=" . $objp->rowid;
                 $urls = DOL_URL_ROOT . "/fourn/card.php?socid=" . $objp->socid;
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => $urlo);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref, 'url' => $urlo);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => $urls);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => $objp->name, 'url' => $urls);
                 $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($date, 'day'));
                 if (!dol_print_date($datel, 'day')) {
                     $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => "No Indicada");
                 } else {
                     $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => dol_print_date($datel, 'day'));
                 }
                 $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', 'text' => $supplierorderstatic->LibStatut($objp->fk_statut, 3));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoSupplierOrder"));
             }
             $db->free($result);
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }