Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
2a0609f133
@ -637,16 +637,17 @@ if (! GETPOST('action'))
|
||||
if (! $sortfield) $sortfield='p.datep';
|
||||
|
||||
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber';
|
||||
$sql .=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c';
|
||||
$sql .= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id';
|
||||
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c';
|
||||
$sql.= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id';
|
||||
$sql.= ' AND f.entity = '.$conf->entity;
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= ' AND f.fk_soc = '.$socid;
|
||||
$sql.= ' AND f.fk_soc = '.$socid;
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY '.$sortfield.' '.$sortorder;
|
||||
$sql .= $db->plimit($limit+1, $offset);
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@ -56,21 +56,22 @@ if (! $sortfield) $sortfield="p.rowid";
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
$sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut";
|
||||
$sql .=", c.libelle as paiement_type, p.num_paiement";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c";
|
||||
$sql.=", c.libelle as paiement_type, p.num_paiement";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c";
|
||||
if ($socid)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
|
||||
}
|
||||
$sql .= " WHERE p.fk_paiement = c.id";
|
||||
$sql.= " WHERE p.fk_paiement = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if ($socid)
|
||||
{
|
||||
$sql.= " AND f.fk_soc = ".$socid;
|
||||
}
|
||||
$sql .= " AND p.statut = 0";
|
||||
$sql .= " ORDER BY $sortfield $sortorder";
|
||||
$sql .= $db->plimit($limit +1 ,$offset);
|
||||
$sql.= " AND p.statut = 0";
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
$sql.= $db->plimit($limit +1 ,$offset);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@ -56,11 +56,11 @@ class Paiement extends CommonObject
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function Paiement($DB)
|
||||
function Paiement($db)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->db = $db ;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,7 +129,7 @@ class Paiement extends CommonObject
|
||||
*/
|
||||
function create($user,$closepaidinvoices=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $conf, $langs;
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -151,8 +151,8 @@ class Paiement extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)";
|
||||
$sql.= " VALUES ('".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)";
|
||||
$sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")";
|
||||
|
||||
dol_syslog(get_class($this)."::Create insert paiement sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -619,10 +619,9 @@ class Paiement extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, c.datec, c.fk_user_creat, c.fk_user_modif,';
|
||||
$sql.= ' c.tms';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as c';
|
||||
$sql.= ' WHERE c.rowid = '.$id;
|
||||
$sql = 'SELECT p.rowid, p.datec, p.fk_user_creat, p.fk_user_modif, p.tms';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p';
|
||||
$sql.= ' WHERE p.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this).'::info sql='.$sql);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -73,6 +73,7 @@ if (GETPOST("orphelins"))
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||
$sql.= " WHERE p.fk_paiement = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND pf.fk_facture IS NULL";
|
||||
}
|
||||
else
|
||||
|
||||
@ -47,170 +47,171 @@ llxHeader();
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($societe);
|
||||
|
||||
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
print "<table width=\"100%\">\n";
|
||||
print '<tr><td valign="top" width="50%">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Nom
|
||||
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
|
||||
print ($societe->prefix_comm?$societe->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "</td></tr></table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
// Factures
|
||||
print_fiche_titre($langs->trans("CustomerPreview"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,";
|
||||
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
|
||||
$sql.= " u.login, u.rowid as userid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
|
||||
$sql.= " AND f.fk_user_valid = u.rowid";
|
||||
$sql.= " ORDER BY f.datef DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Balance").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
print "<table width=\"100%\">\n";
|
||||
print '<tr><td valign="top" width="50%">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Nom
|
||||
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
|
||||
print ($societe->prefix_comm?$societe->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "</td></tr></table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
// Factures
|
||||
print_fiche_titre($langs->trans("CustomerPreview"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,";
|
||||
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
|
||||
$sql.= " u.login, u.rowid as userid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_user_valid = u.rowid";
|
||||
$sql.= " ORDER BY f.datef DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Balance").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
if (! $num > 0)
|
||||
{
|
||||
print '<tr><td colspan="7">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
|
||||
$solde = 0;
|
||||
|
||||
// Boucle sur chaque facture
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
$objf = $db->fetch_object($resql);
|
||||
|
||||
$fac = new Facture($db);
|
||||
$ret=$fac->fetch($objf->facid);
|
||||
if ($ret < 0)
|
||||
{
|
||||
print $fac->error."<br>";
|
||||
continue;
|
||||
}
|
||||
$totalpaye = $fac->getSommePaiement();
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print "<td align=\"center\">".dol_print_date($fac->date)."</td>\n";
|
||||
print "<td><a href=\"../compta/facture.php?facid=$fac->id\">".img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n";
|
||||
|
||||
print '<td aling="left">'.$fac->getLibStatut(2,$totalpaye).'</td>';
|
||||
print '<td align="right">'.price($fac->total_ttc)."</td>\n";
|
||||
$solde = $solde + $fac->total_ttc;
|
||||
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="right">'.price($solde)."</td>\n";
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objf->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objf->login.'</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
// Paiements
|
||||
$sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
|
||||
$sql.= " p.fk_user_creat, u.login, u.rowid as userid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_creat = u.rowid";
|
||||
$sql.= " WHERE pf.fk_paiement = p.rowid";
|
||||
$sql.= " AND pf.fk_facture = ".$fac->id;
|
||||
|
||||
$resqlp = $db->query($sql);
|
||||
if ($resqlp)
|
||||
{
|
||||
$nump = $db->num_rows($resqlp);
|
||||
$j = 0;
|
||||
|
||||
while ($j < $nump)
|
||||
{
|
||||
$objp = $db->fetch_object($resqlp);
|
||||
//$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp))."</td>\n";
|
||||
print '<td>';
|
||||
print ' '; // Decalage
|
||||
print '<a href="paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "<td> </td>\n";
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
$solde = $solde - $objp->amount;
|
||||
print '<td align="right">'.price($solde)."</td>\n";
|
||||
|
||||
{
|
||||
print '<tr><td colspan="7">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
|
||||
$solde = 0;
|
||||
|
||||
// Boucle sur chaque facture
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
$objf = $db->fetch_object($resql);
|
||||
|
||||
$fac = new Facture($db);
|
||||
$ret=$fac->fetch($objf->facid);
|
||||
if ($ret < 0)
|
||||
{
|
||||
print $fac->error."<br>";
|
||||
continue;
|
||||
}
|
||||
$totalpaye = $fac->getSommePaiement();
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print "<td align=\"center\">".dol_print_date($fac->date)."</td>\n";
|
||||
print "<td><a href=\"../compta/facture.php?facid=$fac->id\">".img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n";
|
||||
|
||||
print '<td aling="left">'.$fac->getLibStatut(2,$totalpaye).'</td>';
|
||||
print '<td align="right">'.price($fac->total_ttc)."</td>\n";
|
||||
$solde = $solde + $fac->total_ttc;
|
||||
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="right">'.price($solde)."</td>\n";
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objf->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objf->login.'</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
// Paiements
|
||||
$sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
|
||||
$sql.= " p.fk_user_creat, u.login, u.rowid as userid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_creat = u.rowid";
|
||||
$sql.= " WHERE pf.fk_paiement = p.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND pf.fk_facture = ".$fac->id;
|
||||
|
||||
$resqlp = $db->query($sql);
|
||||
if ($resqlp)
|
||||
{
|
||||
$nump = $db->num_rows($resqlp);
|
||||
$j = 0;
|
||||
|
||||
while ($j < $nump)
|
||||
{
|
||||
$objp = $db->fetch_object($resqlp);
|
||||
//$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp))."</td>\n";
|
||||
print '<td>';
|
||||
print ' '; // Decalage
|
||||
print '<a href="paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "<td> </td>\n";
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
$solde = $solde - $objp->amount;
|
||||
print '<td align="right">'.price($solde)."</td>\n";
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.'</a></td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$j++;
|
||||
}
|
||||
|
||||
$db->free($resqlp);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
print "<br>";
|
||||
}
|
||||
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.'</a></td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$j++;
|
||||
}
|
||||
|
||||
$db->free($resqlp);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
print "<br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
@ -521,7 +521,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$sql.= " cp.code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
|
||||
$sql.= " WHERE pf.fk_paiement = p.rowid and pf.fk_facture = ".$object->id;
|
||||
$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id;
|
||||
$sql.= " ORDER BY p.datep";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -406,7 +406,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$sql.= " cp.code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
|
||||
$sql.= " WHERE pf.fk_paiement = p.rowid and pf.fk_facture = ".$object->id;
|
||||
$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id;
|
||||
$sql.= " ORDER BY p.datep";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -115,16 +115,17 @@ class pdf_paiement
|
||||
|
||||
$sql = "SELECT p.datep as dp, f.facnumber";
|
||||
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
|
||||
$sql .= ", c.code as paiement_code, p.num_paiement";
|
||||
$sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
|
||||
$sql .= ", pf.amount as pf_amount ";
|
||||
$sql .= ", p.rowid as prowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf";
|
||||
$sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
|
||||
$sql .= " AND p.fk_paiement = c.id ";
|
||||
$sql .= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
|
||||
$sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
|
||||
$sql.= ", c.code as paiement_code, p.num_paiement";
|
||||
$sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
|
||||
$sql.= ", pf.amount as pf_amount ";
|
||||
$sql.= ", p.rowid as prowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf";
|
||||
$sql.= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_paiement = c.id ";
|
||||
$sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
|
||||
$sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
|
||||
|
||||
dol_syslog("pdf_paiement::write_file sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user