';
+ print "";
+
+ print '| ';
$strmonth[1] = "Janvier";
$strmonth[2] = "Février";
@@ -158,8 +161,6 @@ if ($action == 'create') {
}
print " | ";
- print "";
-
print '| Auteur | '.$user->fullname.' | ';
print "| Num | | \n";
/*
@@ -245,12 +246,20 @@ if ($action == 'create') {
print "";
/*
* Si il n'y a pas de contact pour la societe on ne permet pas la creation de propale
@@ -278,18 +287,15 @@ if ($action == 'create') {
*/
$sql = "SELECT s.nom,s.idp, p.price, p.ref,".$db->pdate("p.datep")." as dp, p.rowid as propalid, c.id as statut, c.label as lst";
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c ";
-$sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
-if ($socidp) {
- $sql .= " AND s.idp = $socidp";
-}
+$sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND s.idp = $socidp";
$sql .= " ORDER BY p.datec DESC ;";
-
+
if ( $db->query($sql) ) {
$num = $db->num_rows();
$i = 0;
print "";
- print "";
- print "| Societe | ";
+ print " ";
+ print "| Société | ";
print "Num | ";
print "Statut | ";
print "Date | ";
@@ -303,22 +309,25 @@ if ( $db->query($sql) ) {
print "idp\">$objp->nom | \n";
print "propalid\">$objp->ref | \n";
print "$objp->lst | \n";
-
+
print "".strftime("%d %B %Y",$objp->dp)." | \n";
print "".price($objp->price)." | | \n";
print " \n";
-
+
$total = $total + $objp->price;
-
+
$i++;
}
- print "| Total : ".francs($total)." FF | Total : ".price($total)." | euros | ";
+ print "| Total : ".price($total)." | euros | ";
print " ";
$db->free();
} else {
print $db->error();
print "$sql";
}
+/*
+ *
+ */
$db->close();
llxFooter("Dernière modification $Date$ révision $Revision$");
?>
diff --git a/htdocs/comm/contact.php3 b/htdocs/comm/contact.php3
index c3e73093efb..17e064918b6 100644
--- a/htdocs/comm/contact.php3
+++ b/htdocs/comm/contact.php3
@@ -31,15 +31,14 @@ if ($sortfield == "") {
}
if ($page == -1) { $page = 0 ; }
-$limit = 26;
+$limit = $conf->liste_limit;
$offset = $limit * $page ;
-$pageprev = $page - 1;
-$pagenext = $page + 1;
+
+print_barre_liste("Liste des contacts",$page, $PHP_SELF);
print " ";
+print "";
/*
@@ -61,10 +59,9 @@ print " ";
*
*/
-$bc[1]="bgcolor=\"#90c090\"";
-$bc[0]="bgcolor=\"#b0e0b0\"";
-$sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email ";
+
+$sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone ";
$sql .= "FROM societe as s, socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc";
if (strlen($stcomm)) {
@@ -98,12 +95,12 @@ if ($result) {
$sortorder="DESC";
}
print " ";
- print "";
- print "| Action | Nom | ";
- print "Prénom | ";
- print "email | ";
- print "Societe | ";
- print 'Statut | | ';
+ print " ";
+ print "| Nom | ";
+ print "Prénom | ";
+ print_liste_field_titre("Société",$PHP_SELF,"lower(s.nom)", $begin);
+ print " | email | ";
+ print 'Téléphone | | ';
print " \n";
$var=True;
while ($i < $num) {
@@ -113,16 +110,14 @@ if ($result) {
print "";
- print "| [ idp\">T | ";
- print "idp\">E | ";
- print "idp\">F ]";
-
print " | $obj->name | ";
print "$obj->firstname | ";
+
+ print ' ';
+ print "idp\">$obj->nom | \n";
print "$obj->email | \n";
- print ' | ';
- print "idp\">$obj->nom | \n";
- print ''.$obj->stcomm.' | ';
+ print ''.$obj->phone.' | ';
+
print "idp&setcontact=$obj->cidp&action=create\">[Propal] | \n";
print " \n";
$i++;
diff --git a/htdocs/comm/index.php3 b/htdocs/comm/index.php3
index 672f83698b8..5dbcbee8db9 100644
--- a/htdocs/comm/index.php3
+++ b/htdocs/comm/index.php3
@@ -21,10 +21,15 @@
*/
require("./pre.inc.php3");
require("../contact.class.php3");
-require("../societe.class.php3");
+require("../lib/webcal.class.php3");
+require("cactioncomm.class.php3");
+require("actioncomm.class.php3");
+require("../todocomm.class.php3");
llxHeader();
+
$db = new Db();
+
if ($sortorder == "") {
$sortorder="ASC";
}
@@ -32,10 +37,46 @@ if ($sortfield == "") {
$sortfield="nom";
}
+if ($action=='add_action') {
+ /*
+ * Vient de actioncomm.php3
+ *
+ */
+ $actioncomm = new ActionComm($db);
+ $actioncomm->date = $date;
+ $actioncomm->type = $actionid;
+ $actioncomm->contact = $contactid;
+
+ $actioncomm->societe = $socid;
+ $actioncomm->note = $note;
+
+ $actioncomm->add($user);
+
+
+ $societe = new Societe($db);
+ $societe->fetch($socid);
+
+
+ $todo = new TodoComm($db);
+ $todo->date = mktime(12,0,0,$remonth, $reday, $reyear);
+
+ $todo->libelle = $todo_label;
+
+ $todo->societe = $societe->id;
+ $todo->contact = $contactid;
+
+ $todo->note = $todo_note;
+
+ $todo->add($user);
+
+ $webcal = new Webcal();
+ $webcal->add($user, $todo->date, $societe->nom, $todo->libelle);
+}
+
+
if ($action == 'attribute_prefix') {
$societe = new Societe($db, $socid);
$societe->attribute_prefix($db, $socid);
- //$prefix_attrib = soc_attribute_prefix($db, $socid);
}
if ($action == 'recontact') {
@@ -138,18 +179,18 @@ if ($socid > 0) {
print "";
/*
*
*
*/
- print " ";
+
print "\n";
print "";
print "";
@@ -177,58 +218,11 @@ if ($socid > 0) {
*/
print "\n";
print '';
- print '';
- print "| Créée le | " . strftime("%d %b %Y %H:%M", $objsoc->dc) . " | ";
-
- print ' Statut commercial | ';
- print '';
- /*
- *
- * Liste des statuts commerciaux
- *
- */
- $limliste = 5 ;
- print "\n";
-
- $sql = "SELECT a.id, ".$db->pdate("a.datel")." as da, c.libelle, a.author ";
- $sql .= " FROM socstatutlog as a, c_stcomm as c WHERE a.fk_soc = $objsoc->idp AND c.id=a.fk_statut ORDER by a.datel DESC";
- if ( $db->query($sql) ) {
- $i = 0 ; $num = $db->num_rows(); $tag = True;
- while ($i < $num && $i < $limliste) {
- $obj = $db->fetch_object( $i);
- if ($tag) {
- print "";
- } else {
- print " ";
- }
- print "| ". strftime("%d %b %Y %H:%M", $obj->da) ." | ";
- print "$obj->libelle | ";
- print "$obj->author | ";
- print " \n";
- $i++;
- $tag = !$tag;
- }
- $db->free();
- if ($num > $limliste) {
- print "| suite ... | ";
- }
- } else {
- print $db->error();
- }
- print " ";
- print ' | ';
- /*
- *
- */
- print ' ';
- print ' | ';
- /*
- *
- */
- print "";
/*
+ *
* Propales
+ *
*/
$var=!$var;
print "";
@@ -260,19 +254,20 @@ if ($socid > 0) {
/*
* Factures
*/
+ $var=!$var;
$sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
$sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND s.idp = $objsoc->idp ORDER BY f.datef DESC";
if ( $db->query($sql) ) {
$num = $db->num_rows(); $i = 0;
if ($num > 0) {
- print "";
- print "| idp\">liste des factures ($num) | ";
+ print "";
+ print "| idp\">liste des factures ($num) | ";
}
while ($i < $num && $i < 2) {
$objp = $db->fetch_object( $i);
$var=!$var;
- print "";
+ print " ";
print "| facid\">$objp->facnumber | \n";
if ($objp->df > 0 ) {
print "".strftime("%d %B %Y",$objp->df)." | \n";
@@ -292,6 +287,15 @@ if ($socid > 0) {
}
print " ";
+
+
+ print ' | ';
+ /*
+ *
+ */
+ print "| ";
+
+
print " | ";
/*
*
@@ -402,7 +406,8 @@ if ($socid > 0) {
} else {
print " | ";
}
- print "| $obj->firstname $obj->name";
+ print ' | '.$obj->firstname.' '. $obj->name.' | ';
+
if ($obj->note) {
print " ".nl2br($obj->note);
}
@@ -439,16 +444,13 @@ if ($socid > 0) {
if ( $db->query($sql) ) {
print "\n";
- print '| Actions | ';
- $i = 0 ; $num = $db->num_rows(); $tag = True;
+ $i = 0 ; $num = $db->num_rows();
while ($i < $num) {
+ $var = !$var;
+
$obj = $db->fetch_object( $i);
- if ($tag) {
- print "";
- } else {
- print " ";
- }
+ print " ";
if ($oldyear == strftime("%Y",$obj->da) ) {
print '| | | ';
@@ -467,6 +469,8 @@ if ($socid > 0) {
print "" .strftime("%d",$obj->da)." | \n";
print "" .strftime("%H:%M",$obj->da)." | \n";
+ print ' | ';
+
if ($obj->propalrowid) {
print ''.$obj->libelle.' | ';
} else {
@@ -488,7 +492,6 @@ if ($socid > 0) {
print ''.$obj->code.' | ';
print " \n";
$i++;
- $tag = !$tag;
}
print " ";
@@ -510,95 +513,7 @@ if ($socid > 0) {
*
*
*/
- print " ";
- print "\n";
-
- /*
- *
- */
-
- print "\n";
@@ -645,13 +560,8 @@ if ($socid > 0) {
}
print "";
print '';
- print "Société";
-
- print '';
- print ' ';
- print '';
- print ' ';
-
+ print " | ";
+ print_liste_field_titre("Société",$PHP_SELF,"s.nom");
print " | Ville | ";
print "email | ";
print "Statut | | | ";
@@ -680,7 +590,7 @@ if ($socid > 0) {
print " ";
$db->free();
} else {
- print $db->error();
+ print $db->error() . ' ' . $sql;
}
}
$db->close();
diff --git a/htdocs/comm/pre.inc.php3 b/htdocs/comm/pre.inc.php3
index dfe7c20bd4d..ed490ff133e 100644
--- a/htdocs/comm/pre.inc.php3
+++ b/htdocs/comm/pre.inc.php3
@@ -30,80 +30,29 @@ function llxHeader($head = "", $urlp = "") {
*/
top_menu($head);
- print "";
+ $menu = new Menu();
- print "";
+ $menu->add("/comm/index.php3", "Clients");
- print '';
- print "\n";
- print "Nouvelle société \n";
- print "Contacts
\n";
- print "A Recontacter \n";
- print " | ";
+ $menu->add_submenu("../soc.php3?&action=create", "Nouvelle société");
+ $menu->add_submenu("contact.php3", "Contacts");
+ $menu->add("actioncomm.php3", "Actions");
- print '| ';
- print "\n";
- print " | ";
- /*
- *
- */
- print '';
- print '';
- print 'Brouillon ';
- print 'Ouvertes';
- print " | ";
- /*
- *
- */
- print '| ';
- print '';
- print " | ";
- /*
- *
- */
- print '| ';
- print '';
- print '';
- print " | ";
- /*
- *
- */
- print '| ';
- print '';
- print " | ";
- /*
- *
- */
- print '| ';
- print "Societes\n";
- print "";
+ $menu->add("/comm/propal.php3", "Propales");
- print "Contacts\n";
- print "";
+ $menu->add_submenu("propal.php3?viewstatut=0", "Brouillons");
+ $menu->add_submenu("propal.php3?viewstatut=1", "Ouvertes");
- print " | ";
+ $menu->add("/product/", "Produits");
- print " ";
+ $menu->add("/service/", "Services");
- print " | ";
+ $menu->add("projet/", "Projets");
+ left_menu($menu->liste);
- print "\n";
}
-/*
- * $Id$
- * $Source$
- */
+
?>
diff --git a/htdocs/comm/propal-tex.pl b/htdocs/comm/propal-tex.pl
index 3f8946f1e79..1c185a2aed4 100755
--- a/htdocs/comm/propal-tex.pl
+++ b/htdocs/comm/propal-tex.pl
@@ -217,27 +217,27 @@ $dbh->disconnect if $dbh;
#
#
#
-print "Generate dvi file \n";
-system("cd $outputdir/ ; latex $numpropale.tex ");
+#print "Generate dvi file \n";
+system("cd $outputdir/ ; latex $numpropale.tex > /dev/null");
#
#
#
if ($do_pdf) {
- print "Generate pdf file \n";
+ #print " Generate pdf file \n";
system("cd $outputdir/ ; pdflatex $numpropale.tex > /dev/null");
}
#
#
#
if ($do_ps) {
- print "Generate ps file\n";
+ #print "Generate ps file\n";
system("cd $outputdir/ ; dvips $numpropale.dvi -o $numpropale.ps > /dev/null");
}
#
# $outputdir/$numpropale.tex
#
if ($do_fax) {
- print "Generate fax file\n";
+ #print "Generate fax file\n";
system("gs -q -sDEVICE=tiffg3 -dNOPAUSE -sOutputFile=$outputdir/$numpropale.%03d $outputdir/$numpropale.ps socidp = $soc_idp;
$this->products = array();
}
-
- Function add_product($idproduct) {
+ /*
+ *
+ *
+ *
+ */
+ Function add_product($idproduct, $qty) {
if ($idproduct > 0) {
$i = sizeof($this->products);
$this->products[$i] = $idproduct;
+ if (!$qty) {
+ $qty = 1 ;
+ }
+ $this->products_qty[$i] = $qty;
}
}
/*
@@ -53,31 +62,11 @@ class Propal {
*
*/
Function create() {
- /*
- * Total des produits a ajouter
- */
- $sql = "SELECT sum(price) FROM llx_product ";
- $sql .= " WHERE rowid in (";
- for ($i = 0 ; $i < sizeof($this->products) ; $i++) {
- $sql .= $this->products[$i] . ",";
- }
- $sql = substr($sql, 0, strlen($sql)-1) . ");";
-
- if ( $this->db->query($sql) ) {
- $cprice = $this->db->result(0, 0);
- $this->db->free();
- }
- /*
- * Calcul TVA, Remise
- */
- $totalht = $cprice - $this->remise;
- $tva = tva($totalht);
- $total = $totalht + $tva;
/*
* Insertion dans la base
*/
$sql = "INSERT INTO llx_propal (fk_soc, fk_soc_contact, price, remise, tva, total, datep, datec, ref, fk_user_author, note) ";
- $sql .= " VALUES ($this->socidp, $this->contactid, $cprice, $this->remise, $tva, $total, $this->datep, now(), '$this->ref', $this->author, '$this->note')";
+ $sql .= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, 0,0, $this->datep, now(), '$this->ref', $this->author, '$this->note')";
$sqlok = 0;
if ( $this->db->query($sql) ) {
@@ -95,15 +84,19 @@ class Propal {
for ($i = 0 ; $i < sizeof($this->products) ; $i++) {
$prod = new Product($this->db, $this->products[$i]);
- $prod->fetch();
+ $prod->fetch($this->products[$i]);
- $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, price) VALUES ";
- $sql .= " ($propalid,". $this->products[$i].", $prod->price) ; ";
+ $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, qty, price) VALUES ";
+ $sql .= " ($propalid,". $this->products[$i].",". $this->products_qty[$i].", $prod->price) ; ";
if (! $this->db->query($sql) ) {
print $sql . ' ' . $this->db->error() .' ';
}
}
+ /*
+ *
+ */
+ $this->update_price($this->id);
/*
* Affectation au projet
*/
@@ -120,6 +113,46 @@ class Propal {
}
return $this->id;
}
+ /*
+ *
+ *
+ */
+ Function update_price($rowid) {
+ /*
+ * Remise
+ */
+ $sql = "SELECT remise FROM llx_propal WHERE rowid = $rowid";
+ if ( $this->db->query($sql) ) {
+ $remise = $this->db->result(0, 0);
+ $this->db->free();
+
+
+ /*
+ * Total des produits a ajouter
+ */
+ $sql = "SELECT sum(price * qty) FROM llx_propaldet WHERE fk_propal = $rowid";
+ if ( $this->db->query($sql) ) {
+ $cprice = $this->db->result(0, 0);
+ $this->db->free();
+
+ /*
+ * Calcul TVA, Remise
+ */
+ $totalht = $cprice - $this->remise;
+ $tva = tva($totalht);
+ $total = $totalht + $tva;
+ /*
+ *
+ */
+ $sql = "UPDATE llx_propal set price=$cprice, tva=$tva, total=$total WHERE rowid = $rowid";
+ if ( $this->db->query($sql) ) {
+
+ }
+ }
+ }
+
+ }
+
/*
*
*
diff --git a/htdocs/comm/propal.php3 b/htdocs/comm/propal.php3
index 81ce8934c43..040c7abf0d9 100644
--- a/htdocs/comm/propal.php3
+++ b/htdocs/comm/propal.php3
@@ -184,7 +184,7 @@ if ($propalid) {
/*
* Produits
*/
- $sql = "SELECT p.label as product, p.ref, pt.price";
+ $sql = "SELECT p.label as product, p.ref, pt.price, pt.qty";
$sql .= " FROM llx_propaldet as pt, llx_product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid";
$result = $db->query($sql);
@@ -194,7 +194,7 @@ if ($propalid) {
print " Produits ";
print "";
print "| Réf | Produit | ";
- print "Prix | | ";
+ print "Prix | Qté. | ";
print " \n";
$var=True;
@@ -204,7 +204,7 @@ if ($propalid) {
print "";
print "| [$objp->ref] | \n";
print "$objp->product | \n";
- print "".price($objp->price)." | euros | \n";
+ print "".price($objp->price)." | ".$objp->qty." | \n";
print " ";
$total = $total + $objp->price;
$i++;
@@ -536,7 +536,7 @@ if ($propalid) {
print '';
print "| Réf | ";
- print "Societe | ";
+ print "Société | ";
print "Date | ";
print "Prix | ";
print "Statut statutid\">";
diff --git a/htdocs/comm/socnote.php3 b/htdocs/comm/socnote.php3
index 8652fc49d16..350062076b6 100644
--- a/htdocs/comm/socnote.php3
+++ b/htdocs/comm/socnote.php3
@@ -21,7 +21,7 @@
*/
require("./pre.inc.php3");
-//require("../../www/lib/company.class.php3");
+
/*
*
*/
@@ -32,16 +32,6 @@ if ($sortorder == "") {
$sortorder="ASC";
}
-$active["1"] = "Offres en ligne";
-$active["-1"] = "Moderation";
-$active["-2"] = "Refusées";
-$active["0"] = "Rédaction";
-$active["-3"] = "Désactivées";
-$active["-4"] = "Supprimées";
-
-$yn["t"] = "oui";
-$yn["f"] = "non";
-
if ($action == 'stcomm') {
$sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid";
$result = $db->query($sql);
@@ -58,170 +48,29 @@ if ($action == 'stcomm') {
if ($socid > 0) {
- $soc = new Company($db, $socid);
- $soc->fetch();
+ $soc = new Societe($db, $socid);
+ $soc->fetch($socid);
/*
*
*/
- $sql = "SELECT s.idp, s.nom,".$db->pdate("s.datec")." as dc,".$db->pdate("s.datem")." as dm,".$db->pdate("s.datea")." as da, s.intern, s.cjn, s.c_nom, s.c_prenom, s.c_tel, s.c_mail, s.tel, s.fax, s.fplus, s.cjn, s.viewed, st.libelle as stcomm, s.fk_stcomm, s.url,s.cp,s.ville, s.note FROM societe as s, c_stcomm as st ";
- $sql .= " WHERE s.fk_stcomm=st.id";
- $sql .= " AND s.idp = $socid";
+ print ' '.$soc->nom.' ';
+
+
+ print '';
+ print "| ";
+ print " | ";
+ print "| Notes actuelles | ";
+ print "| ".nl2br($soc->note)." | ";
+ print " ";
- $result = $db->query($sql);
-
- if ($result) {
- $objsoc = $db->fetch_object($result , 0);
-
-
-
- print "\n";
-
- print "| N° $objsoc->idp - $soc->nom - [$soc->stcomm] | " ;
-
- print "";
-
- print "";
- print "tel : $soc->tel ";
- print "fax : $soc->fax ";
- print "$soc->cp $soc->ville ";
- if ($objsoc->url) {
- print "url\">$soc->url ";
- }
- print " Contact : $soc->c_nom $soc->c_prenom";
- print " tel : $soc->c_tel";
- print " email : $soc->c_mail";
-
-
- print " | \n";
- print "";
- print "| Créée le | " . strftime("%d %b %Y %H:%M", $objsoc->dc) . " | ";
- print "| Dernière modif le | " . strftime("%d %b %Y %H:%M", $objsoc->dm) . " | ";
- print "| Fiche société | ".$yn[$objsoc->fplus]." | " ;
- print "| Cojonet | ".$yn["$objsoc->cjn"]." | " ;
- print "| Consult Fiche | $objsoc->viewed | ";
- print "Offres";
-
- print "
";
- $sql = "SELECT count(idp) as cc, active FROM offre WHERE fk_soc = $objsoc->idp GROUP by active ORDER BY active DESC";
- $result = $db->query($sql);
- $i = 0 ; $num = $db->num_rows();
- while ($i < $num) {
- $obj = $db->fetch_object( $i);
- print "| ".$active["$obj->active"] . " | : | $obj->cc | ";
- $i++;
- }
- print " | ";
-
- print "Divers ";
- print "";
- $sql = "SELECT count(idp) as cc FROM abo_soc WHERE fksoc = $objsoc->idp GROUP by active";
- $result = $db->query($sql);
- $i = 0 ; $num = $db->num_rows();
- while ($i < $num) {
- $obj = $db->fetch_object( $i);
- print "| Abonnements : | $obj->cc | ";
- $i++;
- }
- $sql = "SELECT count(idp) as cc FROM socfollowresume WHERE fk_soc = $objsoc->idp";
- $result = $db->query($sql);
- $i = 0 ; $num = $db->num_rows();
- while ($i < $num) {
- $obj = $db->fetch_object( $i);
- print "| Cand. suivis : | $obj->cc | ";
- $i++;
- }
- $sql = "SELECT count(idp) as cc FROM soccontact WHERE fk_soc = $objsoc->idp";
- $result = $db->query($sql);
- $i = 0 ; $num = $db->num_rows();
- while ($i < $num) {
- $obj = $db->fetch_object( $i);
- print "| Contacts : | $obj->cc | ";
- $i++;
- }
-
- print " | \n";
- print " ";
-
- print " | \n";
- print " ";
-
- print " ";
- /*
- *
- *
- */
- print "";
- print "";
-
- $sql = "SELECT a.id,".$db->pdate("a.datel")." as da, c.libelle, a.author FROM socstatutlog as a, c_stcomm as c WHERE a.fk_soc = $objsoc->idp AND c.id=a.fk_statut ORDER by a.datel DESC";
- $result = $db->query($sql);
- $i = 0 ; $num = $db->num_rows(); $tag = True;
- while ($i < $num) {
- $obj = $db->fetch_object( $i);
- if ($tag) {
- print "";
- } else {
- print " ";
- }
- print "| ". strftime("%d %b %Y %H:%M", $obj->da) ." | ";
- print "$obj->libelle | ";
- print "$obj->author | ";
- print " \n";
- $i++;
- $tag = !$tag;
- }
- print " ";
-
- print " | ";
- /*
- *
- *
- */
- print "";
-
- print "";
-
- $sql = "SELECT a.id,".$db->pdate("a.datea")." as da, c.libelle, a.author FROM actioncomm as a, c_actioncomm as c WHERE a.fk_soc = $objsoc->idp AND c.id=a.fk_action ORDER by a.datea DESC";
-
- $result = $db->query($sql);
- $i = 0 ; $num = $db->num_rows(); $tag = True;
- while ($i < $num) {
- $obj = $db->fetch_object( $i);
- if ($tag) {
- print "";
- } else {
- print " ";
- }
- print "| ". strftime("%d %b %Y %H:%M", $obj->da) ." | ";
- print "$obj->libelle | ";
- print "$obj->author | ";
- print " \n";
- $i++;
- $tag = !$tag;
- }
- print " ";
-
-
- print " | ";
-
-
- print "";
-
- } else {
- print $db->error();
- }
}
-$db->free();
+
$db->close();
llxFooter();
diff --git a/htdocs/compta/casoc.php3 b/htdocs/compta/casoc.php3
index aeb35653289..cfef43e9d3b 100644
--- a/htdocs/compta/casoc.php3
+++ b/htdocs/compta/casoc.php3
@@ -22,13 +22,9 @@
require("./pre.inc.php3");
llxHeader();
-print 'Chiffre d\'affaire par société ';
-
-$bc[0]="bgcolor=\"#90c090\"";
-$bc[1]="bgcolor=\"#b0e0b0\"";
-
$db = new Db();
+
if ($sortfield == "") {
$sortfield="lower(p.label)";
}
@@ -68,9 +64,8 @@ function liste($db, $paye) {
if ($num > 0) {
$i = 0;
print "";
- print "";
- print "| [Tous] | ";
- print "Societe | ";
+ print " ";
+ print "| Société | ";
print "Montant | | ";
print "Moyenne | ";
print " \n";
@@ -79,7 +74,7 @@ function liste($db, $paye) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "";
- print "| [idp\">Filtre] | \n";
+
print "idp\">$objp->nom | \n";
print "".price($objp->ca)." | | \n";
@@ -89,8 +84,8 @@ function liste($db, $paye) {
print " \n";
$i++;
}
- print " | Total : ".francs($total)." FF | ";
- print "Total : ".price($total)." | euros HT | ";
+ print " ";
+ print "| Total : ".price($total)." | euros HT | ";
print "Moyenne : ".price($total/ $i)." | ";
print " ";
}
@@ -100,6 +95,8 @@ function liste($db, $paye) {
}
}
+print_barre_liste("Chiffre d'affaire par société", $page, $PHP_SELF);
+
print "";
liste($db, 0);
print " ";
diff --git a/htdocs/compta/comp.php3 b/htdocs/compta/comp.php3
index 5dccf06a569..4bd05d8dcf8 100644
--- a/htdocs/compta/comp.php3
+++ b/htdocs/compta/comp.php3
@@ -1,5 +1,6 @@
+ *
* $Id$
* $Source$
*
@@ -20,14 +21,11 @@
*/
require("./pre.inc.php3");
-$bc[0]="bgcolor=\"#90c090\"";
-$bc[1]="bgcolor=\"#b0e0b0\"";
-$a = setlocale("LC_TIME", "FRENCH");
function get_ca_propal ($db, $year, $socidp) {
- $sql = "SELECT sum(f.price) as sum FROM llx_propal as f WHERE fk_statut in (1,2) AND date_format(f.datep, '%Y') = $year ";
+ $sql = "SELECT sum(f.price - f.remise) as sum FROM llx_propal as f WHERE fk_statut in (1,2) AND date_format(f.datep, '%Y') = $year ";
if ($socidp) {
$sql .= " AND f.fk_soc = $socidp";
}
@@ -61,7 +59,7 @@ function get_ca ($db, $year, $socidp) {
function propals ($db, $year, $month) {
global $bc;
- $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
+ $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price - p.remise as price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
$sql .= " AND c.id in (1,2)";
$sql .= " AND date_format(p.datep, '%Y') = $year ";
@@ -70,7 +68,6 @@ function propals ($db, $year, $month) {
$sql .= " ORDER BY p.fk_statut";
-
$result = $db->query($sql);
$num = $db->num_rows();
$i = 0;
@@ -82,42 +79,42 @@ function propals ($db, $year, $month) {
while ($i < $num) {
$objp = $db->fetch_object( $i);
- if ($objp->statut <> $oldstatut ) {
- $oldstatut = $objp->statut;
+ if ($objp->statut <> $oldstatut ) {
+ $oldstatut = $objp->statut;
+
+ if ($i > 0) {
+ print " | | Total : ".price($subtotal)." | \n";
+ print "Euros HT | \n";
+ }
+ $subtotal = 0;
- if ($i > 0) {
- print "| Total : ".price($subtotal)." | \n";
- print "Euros HT | \n";
+ print "";
+ print "| Societe | ";
+ print "Réf | ";
+ print "Date | ";
+ print "Prix | ";
+ print "Statut | ";
+ print " \n";
+ $var=True;
}
- $subtotal = 0;
-
- print "";
- print "| Societe | ";
- print "Réf | ";
- print "Date | ";
- print "Prix | ";
- print "Statut | ";
+
+ $var=!$var;
+ print " ";
+
+ print "| idp\">$objp->nom | \n";
+
+ print "propalid\">$objp->ref | \n";
+
+ print "".strftime("%d %B %Y",$objp->dp)." | \n";
+
+ print "".price($objp->price)." | \n";
+ print "$objp->statut | \n";
print " \n";
- $var=True;
- }
-
- $var=!$var;
- print "";
-
- print "| idp\">$objp->nom | \n";
-
- print "propalid\">$objp->ref | \n";
-
- print "".strftime("%d %B %Y",$objp->dp)." | \n";
-
- print "".price($objp->price)." | \n";
- print "$objp->statut | \n";
- print " \n";
-
- $total = $total + $objp->price;
- $subtotal = $subtotal + $objp->price;
-
- $i++;
+
+ $total = $total + $objp->price;
+ $subtotal = $subtotal + $objp->price;
+
+ $i++;
}
print "| Total : ".price($subtotal)." | \n";
print "Euros HT | \n";
@@ -131,8 +128,7 @@ function propals ($db, $year, $month) {
function factures ($db, $year, $month, $paye) {
- $bc[0]="bgcolor=\"#90c090\"";
- $bc[1]="bgcolor=\"#b0e0b0\"";
+ global $bc;
$sql = "SELECT s.nom, s.idp, f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
$sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND f.paye = $paye";
@@ -190,15 +186,14 @@ function factures ($db, $year, $month, $paye) {
function pt ($db, $sql, $year) {
- $bc[0]="bgcolor=\"#90c090\"";
- $bc[1]="bgcolor=\"#b0e0b0\"";
+ global $bc;
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows();
$i = 0; $total = 0 ;
print "";
- print "";
+ print " ";
print "| Mois | ";
print "Montant | \n";
$var=True;
@@ -261,7 +256,7 @@ function pt ($db, $sql, $year) {
}
function ppt ($db, $year, $socidp) {
-
+ global $bc;
print "";
print "| ";
@@ -272,7 +267,7 @@ function ppt ($db, $year, $socidp) {
print " | | ";
- $sql = "SELECT sum(f.price) as sum, round(date_format(f.datep,'%m')) as dm";
+ $sql = "SELECT sum(f.price - f.remise) as sum, round(date_format(f.datep,'%m')) as dm";
$sql .= " FROM llx_propal as f WHERE fk_statut in (1,2) AND date_format(f.datep,'%Y') = $year ";
if ($socidp) {
@@ -298,12 +293,11 @@ function ppt ($db, $year, $socidp) {
print " | ";
print "";
- print "";
+ print " ";
print "| Mois | ";
print "Montant | ";
print " \n";
- $bc[0]="bgcolor=\"#90c090\"";
- $bc[1]="bgcolor=\"#b0e0b0\"";
+
$var = 1 ;
for ($b = 1 ; $b <= 12 ; $b++) {
$var=!$var;
diff --git a/htdocs/compta/facture.php3 b/htdocs/compta/facture.php3
index d8aa79fed50..4f499b03d16 100644
--- a/htdocs/compta/facture.php3
+++ b/htdocs/compta/facture.php3
@@ -28,8 +28,6 @@ if ($sortorder == "") {
$sortfield="lower(s.nom)";
$sortorder="ASC";
}
-$bc[0]="bgcolor=\"#90c090\"";
-$bc[1]="bgcolor=\"#b0e0b0\"";
$yn["1"] = "oui";
$yn["0"] = "non";
@@ -95,7 +93,7 @@ if ($facid > 0) {
print "| Montant | ".price($obj->amount)." | euros HT | ";
print "| TVA | ".tva($obj->amount)." | euros | ";
print "| Total | ".price($obj->total)." | euros TTC | ";
- print "| soit | ".francs(inctva($obj->amount))." | francs | ";
+
print "";
print " ";
@@ -115,7 +113,7 @@ if ($facid > 0) {
$i = 0; $total = 0;
print "Paiements";
echo ' ';
- print "";
+ print " ";
print "| Date | ";
print "Type | ";
print "Montant | | ";
@@ -163,7 +161,7 @@ if ($facid > 0) {
} else {
print "- | ";
}
- if ($obj->statut == 1 && $resteapayer == 0 && $obj->paye == 0) {
+ if ($obj->statut == 1 && abs($resteapayer == 0) && $obj->paye == 0) {
print "[Classer 'Payée'] | ";
} else {
print "- | ";
@@ -225,7 +223,7 @@ if ($facid > 0) {
$i = 0; $total = 0;
print "Proposition(s) commerciale(s) associée(s)";
print ' ';
- print "";
+ print " ";
print "| Num | ";
print "Date | ";
print "Prix | ";
diff --git a/htdocs/compta/index.php3 b/htdocs/compta/index.php3
index 84eaef4b3ff..2122460ca0b 100644
--- a/htdocs/compta/index.php3
+++ b/htdocs/compta/index.php3
@@ -68,11 +68,11 @@ if ($result) {
$i = 0;
print "";
- print '';
+ print ' ';
print "| [Tous] | ";
- print "Numéro | ";
- print "Societe | ";
- print "Date | Montant | ";
+ print "Numéro | ";
+ print_liste_field_titre("Société",$PHP_SELF,"s.nom");
+ print " | Date | Montant | ";
print "Payé | ";
print " \n";
@@ -89,9 +89,9 @@ if ($result) {
print '';
print "| [Tous] | ";
- print "Numéro | ";
- print "Societe | ";
- print "Date | Montant | ";
+ print "Numéro | ";
+ print_liste_field_titre("Société",$PHP_SELF,"s.nom");
+ print " | Date | Montant | ";
print "Payé | \n";
$sep = 1 ; $j = 0;
$subtotal = 0;
diff --git a/htdocs/compta/paiement.php3 b/htdocs/compta/paiement.php3
index 17a340fbf1d..04ea8278aaa 100644
--- a/htdocs/compta/paiement.php3
+++ b/htdocs/compta/paiement.php3
@@ -4,10 +4,6 @@
* $Id$
* $Source$
*
- * action : - create
- * - add
- *
- *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -23,8 +19,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
- *
- *
*/
require("./pre.inc.php3");
@@ -35,7 +29,6 @@ $db = new Db();
if ($action == 'add') {
$datepaye = $db->idate(mktime(12, 0 , 0, $pmonth, $pday, $pyear));
- $author = $GLOBALS["REMOTE_USER"];
$sql = "INSERT INTO llx_paiement (fk_facture, datec, datep, amount, author, fk_paiement, num_paiement, note)";
$sql .= " VALUES ($facid, now(), $datepaye,$amount,'$author', $paiementid, '$num_paiement', '$note')";
@@ -61,17 +54,32 @@ if ($action == 'add') {
$num = $db->num_rows();
if ($num) {
$obj = $db->fetch_object( 0);
- print "Emettre un paiement";
+
+ $total = $obj->total;
+
+ print_titre("Emettre un paiement");
print " | | |
|