1 |
<?php |
<?php |
2 |
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> |
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> |
3 |
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> |
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> |
4 |
* |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
21 |
*/ |
*/ |
22 |
|
|
23 |
/** |
/** |
24 |
\file htdocs/comm/index.php |
\file htdocs/comm/index.php |
25 |
\ingroup commercial |
\ingroup commercial |
26 |
\brief Page acceuil de la zone commercial |
\brief Page acceuil de la zone commercial |
27 |
\version $Revision$ |
\version $Revision$ |
28 |
*/ |
*/ |
29 |
|
|
30 |
require("./pre.inc.php"); |
require("./pre.inc.php"); |
31 |
if ($conf->contrat->enabled) { |
|
32 |
require_once("../contrat/contrat.class.php"); |
if ($conf->contrat->enabled) |
33 |
} |
require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); |
34 |
|
|
35 |
$langs->load("commercial"); |
$langs->load("commercial"); |
36 |
$langs->load("orders"); |
$langs->load("orders"); |
37 |
|
|
|
$user->getrights('propale'); |
|
|
$user->getrights('fichinter'); |
|
|
$user->getrights('commande'); |
|
|
$user->getrights('projet'); |
|
|
|
|
38 |
// Securité accès client |
// Securité accès client |
39 |
$socidp=''; |
$socidp=''; |
40 |
if ($user->societe_id > 0) |
if ($user->societe_id > 0) |
46 |
|
|
47 |
llxHeader(); |
llxHeader(); |
48 |
|
|
|
|
|
49 |
/* |
/* |
50 |
* Actions |
* Actions |
51 |
*/ |
*/ |
85 |
/* |
/* |
86 |
* Recherche Propal |
* Recherche Propal |
87 |
*/ |
*/ |
88 |
if ($conf->propal->enabled && $user->rights->propale->lire) { |
if ($conf->propal->enabled && $user->rights->propale->lire) |
89 |
$var=false; |
{ |
90 |
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">'; |
$var=false; |
91 |
print '<table class="noborder" width="100%">'; |
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">'; |
92 |
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>'; |
print '<table class="noborder" width="100%">'; |
93 |
print '<tr '.$bc[$var].'>'; |
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>'; |
94 |
print '<td nowrap>'.$langs->trans("Ref").':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td>'; |
print '<tr '.$bc[$var].'>'; |
95 |
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; |
print '<td nowrap>'.$langs->trans("Ref").':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td>'; |
96 |
print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>'; |
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; |
97 |
print '</tr>'; |
print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>'; |
98 |
print "</table></form>\n"; |
print '</tr>'; |
99 |
print "<br>"; |
print "</table></form>\n"; |
100 |
|
print "<br />\n"; |
101 |
} |
} |
102 |
|
|
103 |
/* |
/* |
105 |
*/ |
*/ |
106 |
if ($conf->contrat->enabled) |
if ($conf->contrat->enabled) |
107 |
{ |
{ |
108 |
$var=false; |
$var=false; |
109 |
print '<form method="post" action="'.DOL_URL_ROOT.'/contrat/liste.php">'; |
print '<form method="post" action="'.DOL_URL_ROOT.'/contrat/liste.php">'; |
110 |
print '<table class="noborder" width="100%">'; |
print '<table class="noborder" width="100%">'; |
111 |
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAContract").'</td></tr>'; |
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAContract").'</td></tr>'; |
112 |
print '<tr '.$bc[$var].'>'; |
print '<tr '.$bc[$var].'>'; |
113 |
print '<td nowrap>'.$langs->trans("Ref").':</td><td><input type="text" class="flat" name="search_contract" size="18"></td>'; |
print '<td nowrap>'.$langs->trans("Ref").':</td><td><input type="text" class="flat" name="search_contract" size="18"></td>'; |
114 |
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; |
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; |
115 |
print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>'; |
print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>'; |
116 |
print '</tr>'; |
print '</tr>'; |
117 |
print "</table></form>\n"; |
print "</table></form>\n"; |
118 |
print "<br>"; |
print "<br>"; |
119 |
} |
} |
120 |
|
|
121 |
/* |
/* |
123 |
*/ |
*/ |
124 |
if ($conf->propal->enabled && $user->rights->propale->lire) |
if ($conf->propal->enabled && $user->rights->propale->lire) |
125 |
{ |
{ |
126 |
$sql = "SELECT p.rowid, p.ref, p.price, s.idp, s.nom"; |
$sql = "SELECT p.rowid, p.ref, p.price, s.idp, s.nom"; |
127 |
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; |
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; |
128 |
$sql .= " WHERE p.fk_statut = 0 and p.fk_soc = s.idp"; |
$sql .= " WHERE p.fk_statut = 0 and p.fk_soc = s.idp"; |
129 |
|
|
130 |
$resql=$db->query($sql); |
$resql=$db->query($sql); |
131 |
if ($resql) |
if ($resql) |
132 |
{ |
{ |
133 |
$total = 0; |
$total = 0; |
134 |
$num = $db->num_rows($resql); |
$num = $db->num_rows($resql); |
135 |
if ($num > 0) |
if ($num > 0) |
136 |
{ |
{ |
137 |
print '<table class="noborder" width="100%">'; |
print '<table class="noborder" width="100%">'; |
138 |
print "<tr class=\"liste_titre\">"; |
print "<tr class=\"liste_titre\">"; |
139 |
print "<td colspan=\"3\">".$langs->trans("ProposalsDraft")."</td></tr>"; |
print "<td colspan=\"3\">".$langs->trans("ProposalsDraft")."</td></tr>"; |
140 |
|
|
141 |
$i = 0; |
$i = 0; |
142 |
$var=true; |
$var=true; |
143 |
while ($i < $num) |
while ($i < $num) |
144 |
{ |
{ |
145 |
$obj = $db->fetch_object($resql); |
$obj = $db->fetch_object($resql); |
146 |
$var=!$var; |
$var=!$var; |
147 |
print '<tr '.$bc[$var].'><td nowrap>'."<a href=\"".DOL_URL_ROOT."/comm/propal.php?propalid=".$obj->rowid."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$obj->ref.'</a></td>'; |
print '<tr '.$bc[$var].'><td nowrap>'."<a href=\"".DOL_URL_ROOT."/comm/propal.php?propalid=".$obj->rowid."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$obj->ref.'</a></td>'; |
148 |
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.dolibarr_trunc($obj->nom,18).'</a></td><td align="right">'.price($obj->price).'</td></tr>'; |
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.dolibarr_trunc($obj->nom,18).'</a></td><td align="right">'.price($obj->price).'</td></tr>'; |
149 |
$i++; |
$i++; |
150 |
$total += $obj->price; |
$total += $obj->price; |
|
} |
|
|
if ($total>0) { |
|
|
$var=!$var; |
|
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>"; |
|
151 |
} |
} |
152 |
print "</table><br>"; |
if ($total>0) |
153 |
|
{ |
154 |
|
$var=!$var; |
155 |
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>"; |
156 |
|
} |
157 |
|
print "</table><br>"; |
158 |
} |
} |
159 |
$db->free($resql); |
$db->free($resql); |
160 |
} |
} |
161 |
} |
} |
162 |
|
|
166 |
*/ |
*/ |
167 |
if ($conf->commande->enabled) |
if ($conf->commande->enabled) |
168 |
{ |
{ |
169 |
$langs->load("orders"); |
$langs->load("orders"); |
170 |
$sql = "SELECT c.rowid, c.ref, c.total_ttc, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; |
$sql = "SELECT c.rowid, c.ref, c.total_ttc, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; |
171 |
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 0"; |
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 0"; |
172 |
if ($socidp) |
if ($socidp) |
173 |
{ |
{ |
174 |
$sql .= " AND c.fk_soc = $socidp"; |
$sql .= " AND c.fk_soc = $socidp"; |
175 |
} |
} |
176 |
|
|
177 |
if ( $db->query($sql) ) |
$resql = $db->query($sql); |
178 |
|
if ($resql) |
179 |
{ |
{ |
180 |
$total = 0; |
$total = 0; |
181 |
$num = $db->num_rows(); |
$num = $db->num_rows($resql); |
182 |
if ($num) |
if ($num) |
183 |
{ |
{ |
184 |
print '<table class="noborder" width="100%">'; |
print '<table class="noborder" width="100%">'; |
185 |
print '<tr class="liste_titre">'; |
print '<tr class="liste_titre">'; |
186 |
print '<td colspan="3">'.$langs->trans("DraftOrders").'</td></tr>'; |
print '<td colspan="3">'.$langs->trans("DraftOrders").'</td></tr>'; |
187 |
|
|
188 |
$i = 0; |
$i = 0; |
189 |
$var = true; |
$var = true; |
190 |
while ($i < $num) |
while ($i < $num) |
191 |
{ |
{ |
192 |
$var=!$var; |
$var=!$var; |
193 |
$obj = $db->fetch_object(); |
$obj = $db->fetch_object($resql); |
194 |
print "<tr $bc[$var]><td nowrap><a href=\"../commande/fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref."</a></td>"; |
print "<tr $bc[$var]><td nowrap><a href=\"../commande/fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref."</a></td>"; |
195 |
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.dolibarr_trunc($obj->nom,18).'</a></td>'; |
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.dolibarr_trunc($obj->nom,18).'</a></td>'; |
196 |
print '<td align="right">'.price($obj->total_ttc).'</td></tr>'; |
print '<td align="right">'.price($obj->total_ttc).'</td></tr>'; |
197 |
$i++; |
$i++; |
198 |
$total += $obj->total_ttc; |
$total += $obj->total_ttc; |
|
} |
|
|
if ($total>0) { |
|
|
$var=!$var; |
|
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>"; |
|
199 |
} |
} |
200 |
print "</table><br>"; |
if ($total>0) |
201 |
|
{ |
202 |
|
$var=!$var; |
203 |
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>"; |
204 |
|
} |
205 |
|
print "</table><br>"; |
206 |
} |
} |
207 |
} |
} |
208 |
} |
} |