';
+
/*
* Liste des categories
- *
+ * \TODO Il n'y a aucun écran pour les saisir !
*/
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."fournisseur_categorie";
@@ -70,31 +75,35 @@ $sql.= " ORDER BY label ASC";
$resql = $db->query($sql);
if ($resql)
{
- $num = $db->num_rows($resql);
- $i = 0;
-
- print '';
- print '| ';
- print $langs->trans("Category");
- print " | \n";
- $var=True;
+ $num = $db->num_rows($resql);
+ $i = 0;
- while ($obj = $db->fetch_object($resql))
- {
- $var=!$var;
- print "\n";
- print '| '.stripslashes($obj->label).'';
- print ' | ';
- print '('.$langs->trans("Stats").')';
- print " | \n";
- }
- print " \n";
+ if ($num)
+ {
+ print '';
+ print '| ';
+ print $langs->trans("Category");
+ print " | \n";
+ $var=True;
- $db->free($resql);
+ while ($obj = $db->fetch_object($resql))
+ {
+ $var=!$var;
+ print "\n";
+ print '| '.stripslashes($obj->label).'';
+ print ' | ';
+ print '('.$langs->trans("Stats").')';
+ print " | \n";
+ }
+ print " \n";
+ print " \n";
+ }
+
+ $db->free($resql);
}
else
{
- dolibarr_print_error($db);
+ dolibarr_print_error($db);
}
@@ -112,29 +121,30 @@ $sql.= " GROUP BY cf.fk_statut";
$resql = $db->query($sql);
if ($resql)
{
- $num = $db->num_rows($resql);
- $i = 0;
-
- print '
';
- print '| '.$langs->trans("Orders").' | '.$langs->trans("Nb").' | | ';
- print " \n";
- $var=True;
+ $num = $db->num_rows($resql);
+ $i = 0;
- while ($i < $num)
- {
- $row = $db->fetch_row($resql);
- $var=!$var;
+ print '';
+ print '| '.$langs->trans("Orders").' | '.$langs->trans("Nb").' | | ';
+ print " \n";
+ $var=True;
- print "";
- print '| '.$commande->statuts[$row[1]].' | ';
- print ''.$row[0].' | ';
- print ''.$commande->LibStatut($row[1],3).' | ';
+ while ($i < $num)
+ {
+ $row = $db->fetch_row($resql);
+ $var=!$var;
- print " \n";
- $i++;
- }
- print " ";
- $db->free($resql);
+ print "";
+ print '| '.$commande->statuts[$row[1]].' | ';
+ print ''.$row[0].' | ';
+ print ''.$commande->LibStatut($row[1],3).' | ';
+
+ print " \n";
+ $i++;
+ }
+ print " ";
+ print " \n";
+ $db->free($resql);
}
else
{
@@ -142,14 +152,71 @@ else
}
+/*
+ * Commandes brouillons
+ */
+if ($conf->fournisseur->enabled)
+{
+ $langs->load("orders");
+ $sql = "SELECT c.rowid, c.ref, c.total_ttc, s.nom, s.idp";
+ $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."societe as s";
+ $sql.= " WHERE c.fk_soc = s.idp AND c.fk_statut = 0";
+ if ($socid)
+ {
+ $sql .= " AND c.fk_soc = ".$socid;
+ }
+
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $total = 0;
+ $num = $db->num_rows($resql);
+ if ($num)
+ {
+ print '';
+ print '';
+ print '| '.$langs->trans("DraftOrders").' | ';
+
+ $i = 0;
+ $var = true;
+ while ($i < $num)
+ {
+ $var=!$var;
+ $obj = $db->fetch_object($resql);
+ print "| ";
+ $commandestatic->id=$obj->rowid;
+ $commandestatic->ref=$obj->ref;
+ print $commandestatic->getNomUrl(1,'',16);
+ print ' | ';
+ print '';
+ $companystatic->id=$obj->idp;
+ $companystatic->nom=$obj->nom;
+ $companystatic->client=0;
+ print $companystatic->getNomUrl(1,'',16);
+ print ' | ';
+ print ''.price($obj->total_ttc).' | ';
+ $i++;
+ $total += $obj->total_ttc;
+ }
+ if ($total>0)
+ {
+ $var=!$var;
+ print '| '.$langs->trans("Total").' | '.price($total)." | ";
+ }
+ print " ";
+ print " \n";
+ }
+ }
+}
+
/**
* Factures brouillons
*/
-if ($conf->facture->enabled && $user->rights->fournisseur->facture->lire)
+if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
{
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,";
$sql.= " s.nom, s.idp";
- $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.idp = f.fk_soc AND f.fk_statut = 0";
if ($socid)
{
@@ -163,9 +230,7 @@ if ($conf->facture->enabled && $user->rights->fournisseur->facture->lire)
$num = $db->num_rows($resql);
if ($num)
{
- $companystatic=new Societe($db);
-
- print '
';
+ print '';
print '';
print '| '.$langs->trans("DraftBills").' ('.$num.') | ';
$i = 0;
@@ -184,7 +249,7 @@ if ($conf->facture->enabled && $user->rights->fournisseur->facture->lire)
print '';
$companystatic->id=$obj->idp;
$companystatic->nom=$obj->nom;
- $companystatic->client=1;
+ $companystatic->client=0;
print $companystatic->getNomUrl(1,'',16);
print ' | ';
print ''.price($obj->total_ttc).' | ';
@@ -197,7 +262,8 @@ if ($conf->facture->enabled && $user->rights->fournisseur->facture->lire)
print ''.price($tot_ttc).' | ';
print '';
- print " ";
+ print " ";
+ print " \n";
}
$db->free($resql);
}
diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql
index 7f0272093cc..eed942072f8 100644
--- a/mysql/migration/2.0.0-2.1.0.sql
+++ b/mysql/migration/2.0.0-2.1.0.sql
@@ -153,6 +153,7 @@ update llx_commande set date_livraison = null where date_livraison = '1970-01-01
ALTER TABLE llx_facture_fourn DROP INDEX facnumber;
ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc);
ALTER TABLE llx_facture_fourn ADD note_public text after note;
+alter table llx_facture_fourn add column `type` smallint DEFAULT 0 NOT NULL after facnumber;
ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_facture (fk_facture_fourn);
ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_facture FOREIGN KEY (fk_facture_fourn) REFERENCES llx_facture_fourn (rowid);
diff --git a/mysql/tables/llx_facture_fourn.sql b/mysql/tables/llx_facture_fourn.sql
index 6eae6680a7c..14366933429 100644
--- a/mysql/tables/llx_facture_fourn.sql
+++ b/mysql/tables/llx_facture_fourn.sql
@@ -24,6 +24,7 @@ create table llx_facture_fourn
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
facnumber varchar(50) NOT NULL,
+ type smallint DEFAULT 0 NOT NULL,
fk_soc integer NOT NULL,
datec datetime, -- date de creation de la facture
datef date, -- date de la facture
|