Synchro
This commit is contained in:
parent
3b19b3b4c9
commit
28fff34a50
@ -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 prélèvement", $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
|
||||
print_barre_liste("Demandes de prélèvement à traiter", $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>Facture</td><td>Société</td></tr>';
|
||||
print '<td>Facture</td><td>Société</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"].'"> ';
|
||||
print '<input type="submit" value="Chercher">';
|
||||
print '<input type="submit" value="Chercher"></td>';
|
||||
print '<td colspan="2"> </td></tr>';
|
||||
print '</form>';
|
||||
|
||||
if ($num)
|
||||
$var = True;
|
||||
|
||||
$users = array();
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
$var = True;
|
||||
|
||||
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> ';
|
||||
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> ';
|
||||
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"]."&socid=".$_GET["socid"],"Rejet de prélèvement","Etes-vous sûr de vouloir saisir un rejet de prélèvement pour la société ".$soc->nom." ?","confirm_rejet");
|
||||
$html->form_confirm("factures.php"."?id=".$_GET["id"]."&socid=".$_GET["socid"]."&previd=".$_GET["previd"],"Rejet de prélèvement","Etes-vous sûr de vouloir saisir un rejet de prélèvement pour la société ".$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("Société","factures.php","s.nom",'',$urladd);
|
||||
print_liste_field_titre("Montant","factures.php","f.total_ttc","",$urladd,'align="center"');
|
||||
print '<td> </td></tr>';
|
||||
print '<td colspan="2"> </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"].'&action=rejet&socid='.$obj->idp.'">';
|
||||
print "Saisir rejet";
|
||||
print '</a></td>';
|
||||
print '<td>';
|
||||
|
||||
if ($obj->statut == 0)
|
||||
{
|
||||
print '-';
|
||||
}
|
||||
elseif ($obj->statut == 1)
|
||||
{
|
||||
print 'Crédité';
|
||||
}
|
||||
elseif ($obj->statut == 2)
|
||||
{
|
||||
print '<b>Rejeté</b>';
|
||||
}
|
||||
|
||||
print '</td><td>';
|
||||
|
||||
if ($obj->statut == 1)
|
||||
{
|
||||
print '<a href="factures.php?id='.$_GET["id"].'&action=rejet&socid='.$obj->idp;
|
||||
print '&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 impayée */
|
||||
dolibarr_syslog("RejetPrelevement::Create set_unpayed fac ".$fac->ref);
|
||||
$fac->set_unpayed($facs[$i]);
|
||||
|
||||
/* Tag la ligne de prev comme rejetée */
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user