Skip to content
Snippets Groups Projects
Commit 28fff34a authored by Rodolphe Quiedeville's avatar Rodolphe Quiedeville
Browse files

Synchro

parent 3b19b3b4
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,8 @@ if ($sortfield == "") $sortfield="f.facnumber";
*/
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp";
$sql .= " , ".$db->pdate("pfd.date_demande")." as date_demande";
$sql .= " , pfd.fk_user_demande";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE s.idp = f.fk_soc";
......@@ -81,41 +83,45 @@ if ( $db->query($sql) )
$num = $db->num_rows();
$i = 0;
print_barre_liste("Demandes de prlvement", $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
print_barre_liste("Demandes de prlvement traiter", $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>Facture</td><td>Socit</td></tr>';
print '<td>Facture</td><td>Socit</td><td>Date demande</td>';
print '<td>Emetteur</td></tr>';
print '<form action="demandes.php" method="GET">';
print '<tr class="liste_titre"><td>-</td><td>';
print '<input type="text" name="search_societe" size="12" value="'.$GET["search_societe"].'">&nbsp;';
print '<input type="submit" value="Chercher">';
print '<input type="submit" value="Chercher"></td>';
print '<td colspan="2">&nbsp;</td></tr>';
print '</form>';
if ($num)
{
$var = True;
$var = True;
$users = array();
while ($i < min($num,$conf->liste_limit))
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object();
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().'</a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.$obj->facnumber.'</a></td>';
print '<td>'.$obj->nom.'</td>';
print '<td>'.strftime("%d %m %Y", $obj->date_demande).'</td>';
if (!array_key_exists($obj->fk_user_demande,$users))
{
$obj = $db->fetch_object();
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().'</a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.$obj->facnumber.'</a></td>';
print '<td>'.$obj->nom.'</td></tr>';
$i++;
$users[$obj->fk_user_demande] = new User($db, $obj->fk_user_demande);
$users[$obj->fk_user_demande]->fetch();
}
print "</table><br>";
print '<td>'.$users[$obj->fk_user_demande]->fullname.'</td>';
print '</tr>';
$i++;
}
print "</table><br />";
}
else
{
......
......@@ -36,7 +36,7 @@ if ($_POST["action"] == 'confirm_rejet')
{
$rej = new RejetPrelevement($db, $user);
$rej->create($_GET["id"], $_GET["socid"]);
$rej->create($_GET["id"], $_GET["socid"], $_GET["previd"]);
Header("Location: factures.php?id=".$_GET["id"]);
}
......@@ -59,6 +59,10 @@ $head[$h][1] = $langs->trans("Factures");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Statistiques");
$h++;
$prev_id = $_GET["id"];
if ($_GET["id"])
......@@ -90,7 +94,7 @@ if ($_GET["action"] == 'rejet')
$soc = new Societe($db);
$soc->fetch($_GET["socid"]);
$html->form_confirm("factures.php"."?id=".$_GET["id"]."&amp;socid=".$_GET["socid"],"Rejet de prlvement","Etes-vous sr de vouloir saisir un rejet de prlvement pour la socit ".$soc->nom." ?","confirm_rejet");
$html->form_confirm("factures.php"."?id=".$_GET["id"]."&amp;socid=".$_GET["socid"]."&amp;previd=".$_GET["previd"],"Rejet de prlvement","Etes-vous sr de vouloir saisir un rejet de prlvement pour la socit ".$soc->nom." ?","confirm_rejet");
print '<table class="border" width="100%">';
......@@ -121,7 +125,7 @@ if ($sortfield == "") {
*
*
*/
$sql = "SELECT pf.rowid, ".$db->pdate("p.datec")." as datec";
$sql = "SELECT pf.rowid, pf.statut";
$sql .= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc";
$sql .= " , s.idp, s.nom";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement as p";
......@@ -155,7 +159,7 @@ if ($result)
print_liste_field_titre("Facture","factures.php","p.ref",'',$urladd);
print_liste_field_titre("Socit","factures.php","s.nom",'',$urladd);
print_liste_field_titre("Montant","factures.php","f.total_ttc","",$urladd,'align="center"');
print '<td>&nbsp;</td></tr>';
print '<td colspan="2">&nbsp;</td></tr>';
$var=True;
......@@ -173,13 +177,35 @@ if ($result)
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
print '<td>'.stripslashes($obj->nom)."</td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->idp.'">'.stripslashes($obj->nom)."</a></td>\n";
print '<td align="center">'.price($obj->total_ttc)."</td>\n";
print '<td><a href="factures.php?id='.$_GET["id"].'&amp;action=rejet&amp;socid='.$obj->idp.'">';
print "Saisir rejet";
print '</a></td>';
print '<td>';
if ($obj->statut == 0)
{
print '-';
}
elseif ($obj->statut == 1)
{
print 'Crdit';
}
elseif ($obj->statut == 2)
{
print '<b>Rejet</b>';
}
print '</td><td>';
if ($obj->statut == 1)
{
print '<a href="factures.php?id='.$_GET["id"].'&amp;action=rejet&amp;socid='.$obj->idp;
print '&amp;previd='.$bon->id.'">';
print "Saisir rejet</a>";
}
print '</td>';
print "</tr>\n";
......
......@@ -51,7 +51,7 @@ class RejetPrelevement
$this->user = $user;
}
function create($id, $socid)
function create($id, $socid, $previd)
{
$this->id = $id;
$this->socid = $socid;
......@@ -80,12 +80,26 @@ class RejetPrelevement
{
$error++;
dolibarr_syslog("RejetPrelevement::Create Erreur creation paiement facture ".$facs[$i]);
}
}
/* Tag la facture comme impaye */
dolibarr_syslog("RejetPrelevement::Create set_unpayed fac ".$fac->ref);
$fac->set_unpayed($facs[$i]);
/* Tag la ligne de prev comme rejete */
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_facture ";
$sql .= " SET statut = 2";
$sql .= " WHERE fk_prelevement=".$previd;
$sql .= " AND fk_facture = ".$facs[$i];
$result=$this->db->query($sql);
if (!$result)
{
dolibarr_syslog("RejetPrelevement::create Erreur 3");
$error++;
}
/* Envoi un email l'emetteur de la demande de prev */
$this->_send_email($fac);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment