Merge pull request #792 from grandoc/develop
try to fix :supplier invoice numbering
This commit is contained in:
commit
07fc55de4b
@ -258,7 +258,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
*/
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,";
|
||||
$sql = "SELECT f.ref_supplier, f.rowid, f.total_ttc, f.type,";
|
||||
$sql.= " s.nom, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -287,7 +287,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr '.$bc[$var].'><td nowrap>';
|
||||
$facturesupplierstatic->ref=$obj->facnumber;
|
||||
$facturesupplierstatic->ref=$obj->ref;
|
||||
$facturesupplierstatic->id=$obj->rowid;
|
||||
$facturesupplierstatic->type=$obj->type;
|
||||
print $facturesupplierstatic->getNomUrl(1,'',16);
|
||||
@ -432,7 +432,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$langs->load("boxes");
|
||||
$facstatic=new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye";
|
||||
$sql = "SELECT ff.rowid, ff.ref_supplier, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye";
|
||||
$sql.= ", s.nom, s.rowid as socid";
|
||||
$sql.= ", SUM(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
@ -442,7 +442,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref_supplier, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid";
|
||||
$sql.= " ORDER BY ff.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -467,7 +467,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$facstatic->ref=$obj->facnumber;
|
||||
$facstatic->ref=$obj->ref;
|
||||
$facstatic->id=$obj->rowid;
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
@ -930,7 +930,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
{
|
||||
$facstatic=new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,";
|
||||
$sql = "SELECT ff.rowid, ff.ref_supplier, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,";
|
||||
$sql.= " s.nom, s.rowid as socid,";
|
||||
$sql.= " sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
@ -942,7 +942,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref_supplier, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.rowid";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -967,7 +967,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$facstatic->ref=$obj->facnumber;
|
||||
$facstatic->ref=$obj->ref;
|
||||
$facstatic->id=$obj->rowid;
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
@ -1033,7 +1033,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
//print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
print '<div></div></div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn (";
|
||||
$sql.= "ref";
|
||||
$sql.= ", facnumber";
|
||||
$sql.= ", ref_supplier";
|
||||
$sql.= ", entity";
|
||||
$sql.= ", libelle";
|
||||
$sql.= ", fk_soc";
|
||||
@ -263,7 +263,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.ref,";
|
||||
$sql.= " t.facnumber,";
|
||||
$sql.= " t.ref_supplier,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.type,";
|
||||
$sql.= " t.fk_soc,";
|
||||
@ -298,7 +298,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= ' s.nom as socnom, s.rowid as socid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t,'.MAIN_DB_PREFIX.'societe as s';
|
||||
if ($id) $sql.= " WHERE t.rowid=".$id;
|
||||
if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; // ref is id (facnumber is supplier ref)
|
||||
if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'";
|
||||
$sql.= ' AND t.fk_soc = s.rowid';
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
@ -312,8 +312,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
|
||||
$this->ref_supplier = $obj->facnumber;
|
||||
$this->facnumber = $obj->facnumber;
|
||||
$this->ref_supplier = $obj->ref_supplier;
|
||||
$this->entity = $obj->entity;
|
||||
$this->type = empty($obj->type)?0:$obj->type;
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
@ -501,7 +500,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET";
|
||||
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
||||
$sql.= " facnumber=".(isset($this->facnumber)?"'".$this->db->escape($this->facnumber)."'":"null").",";
|
||||
$sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").",";
|
||||
$sql.= " entity=".(isset($this->entity)?$this->entity:"null").",";
|
||||
$sql.= " type=".(isset($this->type)?$this->type:"null").",";
|
||||
$sql.= " fk_soc=".(isset($this->fk_soc)?$this->fk_soc:"null").",";
|
||||
@ -664,39 +663,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
return -$error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set supplier ref
|
||||
*
|
||||
* @param User $user User that make change
|
||||
* @param string $ref_supplier Supplier ref
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_ref_supplier($user, $ref_supplier)
|
||||
{
|
||||
if ($user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn SET facnumber = '.(empty($ref_supplier) ? 'NULL' : '\''.$this->db->escape($ref_supplier).'\'');
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog("FactureFournisseur::set_ref_supplier sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->ref_supplier = $ref_supplier;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog('FactureFournisseur::set_ref_supplier '.$this->error.' - '.$sql, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tag invoice as a payed invoice
|
||||
|
||||
@ -170,12 +170,13 @@ elseif ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->fournis
|
||||
}
|
||||
|
||||
// Set supplier ref
|
||||
elseif ($action == 'setfacnumber' && $user->rights->fournisseur->facture->creer)
|
||||
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->set_ref_supplier($user, GETPOST('facnumber'));
|
||||
$result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha'));
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
// Set label
|
||||
elseif ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
@ -253,7 +254,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
$_GET['socid']=$_POST['socid'];
|
||||
$error++;
|
||||
}
|
||||
if (! GETPOST('facnumber'))
|
||||
if (! GETPOST('ref_supplier'))
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')).'</div>';
|
||||
$action='create';
|
||||
@ -267,7 +268,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
|
||||
// Creation facture
|
||||
$object->ref = $_POST['ref'];
|
||||
$object->facnumber = $_POST['facnumber'];
|
||||
$object->ref_supplier = $_POST['ref_supplier'];
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->libelle = $_POST['libelle'];
|
||||
$object->date = $datefacture;
|
||||
@ -1048,7 +1049,7 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
|
||||
// Ref supplier
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="facnumber" value="'.(isset($_POST['facnumber'])?$_POST['facnumber']:$fac_ori->ref).'" type="text"></td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier'])?$_POST['ref_supplier']:$fac_ori->ref).'" type="text"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
|
||||
@ -1352,8 +1353,8 @@ else
|
||||
print "</tr>\n";
|
||||
|
||||
// Ref supplier
|
||||
print '<tr><td>'.$form->editfieldkey("RefSupplier",'facnumber',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td><td colspan="4">';
|
||||
print $form->editfieldval("RefSupplier",'facnumber',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer));
|
||||
print '<tr><td>'.$form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td><td colspan="4">';
|
||||
print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer));
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party
|
||||
|
||||
@ -89,7 +89,7 @@ if (! $sortorder) $sortorder="ASC";
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT s.rowid as socid, s.nom,";
|
||||
$sql.= " f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc,";
|
||||
$sql.= " f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc,";
|
||||
$sql.= " f.datef as df, f.date_lim_reglement as datelimite, ";
|
||||
$sql.= " f.paye as paye, f.rowid as facid, f.fk_statut";
|
||||
$sql.= " ,sum(pf.amount) as am";
|
||||
@ -121,7 +121,7 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
}
|
||||
if ($search_ref_supplier)
|
||||
{
|
||||
$sql .= " AND f.facnumber LIKE '%".$search_ref_supplier."%'";
|
||||
$sql .= " AND f.ref_supplier LIKE '%".$search_ref_supplier."%'";
|
||||
}
|
||||
|
||||
if ($search_societe)
|
||||
@ -141,14 +141,14 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
|
||||
if (dol_strlen(GETPOST('sf_re')) > 0)
|
||||
{
|
||||
$sql .= " AND f.facnumber LIKE '%".GETPOST('sf_re')."%'";
|
||||
$sql .= " AND f.ref_supplier LIKE '%".GETPOST('sf_re')."%'";
|
||||
}
|
||||
$sql.= " GROUP BY f.facnumber, f.rowid, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, s.rowid, s.nom";
|
||||
$sql.= " GROUP BY f.ref_supplier, f.rowid, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, s.rowid, s.nom";
|
||||
|
||||
$sql.= " ORDER BY ";
|
||||
$listfield=explode(',',$sortfield);
|
||||
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
|
||||
$sql.= " f.facnumber DESC";
|
||||
$sql.= " f.ref_supplier DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -191,7 +191,7 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"f.facnumber","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"f.ref_supplier","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
@ -242,7 +242,7 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
print $facturestatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
print "<td nowrap>".dol_trunc($objp->facnumber,12)."</td>\n";
|
||||
print "<td nowrap>".dol_trunc($objp->ref_supplier,12)."</td>\n";
|
||||
|
||||
print "<td nowrap align=\"center\">".dol_print_date($db->jdate($objp->df),'day')."</td>\n";
|
||||
print "<td nowrap align=\"center\">".dol_print_date($db->jdate($objp->datelimite),'day');
|
||||
|
||||
@ -103,7 +103,7 @@ $htmlother=new FormOther($db);
|
||||
llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom, ";
|
||||
$sql.= " fac.rowid as facid, fac.ref, fac.facnumber, fac.datef, fac.date_lim_reglement as date_echeance,";
|
||||
$sql.= " fac.rowid as facid, fac.ref, fac.ref_supplier, fac.datef, fac.date_lim_reglement as date_echeance,";
|
||||
$sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac";
|
||||
@ -131,7 +131,7 @@ if (GETPOST("search_ref"))
|
||||
}
|
||||
if (GETPOST("search_ref_supplier"))
|
||||
{
|
||||
$sql .= " AND fac.facnumber LIKE '%".$db->escape(GETPOST("search_ref_supplier"))."%'";
|
||||
$sql .= " AND fac.ref_supplier LIKE '%".$db->escape(GETPOST("search_ref_supplier"))."%'";
|
||||
}
|
||||
if ($month > 0)
|
||||
{
|
||||
@ -193,7 +193,7 @@ if ($resql)
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"facnumber","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"ref_supplier","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef,fac.rowid","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"fac.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"fac.libelle","",$param,"",$sortfield,$sortorder);
|
||||
@ -249,10 +249,10 @@ if ($resql)
|
||||
print '<td nowrap="nowrap">';
|
||||
$facturestatic->id=$obj->facid;
|
||||
$facturestatic->ref=$obj->ref;
|
||||
$facturestatic->ref_supplier=$obj->facnumber;
|
||||
$facturestatic->ref_supplier=$obj->ref_supplier;
|
||||
print $facturestatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
print '<td nowrap="nowrap">'.dol_trunc($obj->facnumber,10)."</td>";
|
||||
print '<td nowrap="nowrap">'.dol_trunc($obj->ref_supplier,10)."</td>";
|
||||
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($obj->datef),'day').'</td>';
|
||||
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($obj->date_echeance),'day');
|
||||
if (($obj->paye == 0) && ($obj->fk_statut > 0) && $db->jdate($obj->date_echeance) < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
|
||||
|
||||
@ -192,7 +192,7 @@ if ($action == 'create' || $action == 'add_paiement')
|
||||
$dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture);
|
||||
|
||||
$sql = 'SELECT s.nom, s.rowid as socid,';
|
||||
$sql.= ' f.rowid as ref, f.facnumber, f.amount, f.total_ttc as total';
|
||||
$sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -214,7 +214,7 @@ if ($action == 'create' || $action == 'add_paiement')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add_paiement">';
|
||||
print '<input type="hidden" name="facid" value="'.$facid.'">';
|
||||
print '<input type="hidden" name="facnumber" value="'.$obj->facnumber.'">';
|
||||
print '<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.'">';
|
||||
print '<input type="hidden" name="socid" value="'.$obj->socid.'">';
|
||||
print '<input type="hidden" name="societe" value="'.$obj->nom.'">';
|
||||
|
||||
@ -257,7 +257,7 @@ if ($action == 'create' || $action == 'add_paiement')
|
||||
/*
|
||||
* Autres factures impayees
|
||||
*/
|
||||
$sql = 'SELECT f.rowid as facid, f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc, f.datef as df';
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef as df';
|
||||
$sql.= ', SUM(pf.amount) as am';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
|
||||
@ -265,7 +265,7 @@ if ($action == 'create' || $action == 'add_paiement')
|
||||
$sql.= ' AND f.fk_soc = '.$object->socid;
|
||||
$sql.= ' AND f.paye = 0';
|
||||
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.total_ht, f.total_ttc, f.datef';
|
||||
$sql.= ' GROUP BY f.rowid, f.ref_supplier, f.total_ht, f.total_ttc, f.datef';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -298,7 +298,7 @@ if ($action == 'create' || $action == 'add_paiement')
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="fiche.php?facid='.$objp->facid.'">'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->ref;
|
||||
print '</a></td>';
|
||||
print '<td>'.$objp->facnumber.'</td>';
|
||||
print '<td>'.$objp->ref_supplier.'</td>';
|
||||
if ($objp->df > 0 )
|
||||
{
|
||||
print '<td align="center">';
|
||||
@ -441,7 +441,7 @@ if (empty($action))
|
||||
print_liste_field_titre($langs->trans('Type'),'paiement.php','c.libelle','',$paramlist,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Account'),'paiement.php','ba.label','',$paramlist,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Amount'),'paiement.php','f.amount','',$paramlist,'align="right"',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans('Invoice'),'paiement.php','facnumber','',$paramlist,'',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans('Invoice'),'paiement.php','ref_supplier','',$paramlist,'',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lines for filters fields
|
||||
@ -492,7 +492,7 @@ if (empty($action))
|
||||
print '<td align="right">'.price($objp->pamount).'</td>';
|
||||
|
||||
// Ref invoice
|
||||
/*$invoicesupplierstatic->ref=$objp->facnumber;
|
||||
/*$invoicesupplierstatic->ref=$objp->ref_supplier;
|
||||
$invoicesupplierstatic->id=$objp->facid;
|
||||
print '<td nowrap="nowrap">';
|
||||
print $invoicesupplierstatic->getNomUrl(1);
|
||||
|
||||
@ -319,12 +319,12 @@ if ($object->fetch($id))
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
// TODO move to DAO class
|
||||
$sql = 'SELECT f.rowid,f.libelle,f.facnumber,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,';
|
||||
$sql = 'SELECT f.rowid,f.libelle,f.ref_supplier,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,';
|
||||
$sql.= ' SUM(pf.amount) as am';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn';
|
||||
$sql.= ' WHERE f.fk_soc = '.$object->id;
|
||||
$sql.= ' GROUP BY f.rowid,f.libelle,f.facnumber,f.fk_statut,f.datef,f.total_ttc,f.paye';
|
||||
$sql.= ' GROUP BY f.rowid,f.libelle,f.ref_supplier,f.fk_statut,f.datef,f.total_ttc,f.paye';
|
||||
$sql.= ' ORDER BY f.datef DESC';
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -349,7 +349,7 @@ if ($object->fetch($id))
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
print '<a href="facture/fiche.php?facid='.$obj->rowid.'">';
|
||||
print img_object($langs->trans('ShowBill'),'bill').' '.$obj->facnumber.'</a> '.dol_trunc($obj->libelle,14).'</td>';
|
||||
print img_object($langs->trans('ShowBill'),'bill').' '.$obj->ref_supplier.'</a> '.dol_trunc($obj->libelle,14).'</td>';
|
||||
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($obj->df),'day').'</td>';
|
||||
print '<td align="right" nowrap="nowrap">'.price($obj->amount).'</td>';
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
|
||||
@ -163,7 +163,7 @@ if (! empty($conf->fournisseur->enabled))
|
||||
// Draft invoices
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT ff.facnumber, ff.rowid, ff.total_ttc, ff.type";
|
||||
$sql = "SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type";
|
||||
$sql.= ", s.nom, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -192,7 +192,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td nowrap="nowrap">';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->ref=$obj->ref;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->type=$obj->type;
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
@ -321,7 +321,7 @@ if (count($companystatic->SupplierCategories))
|
||||
|
||||
|
||||
//print "</td></tr></table>\n";
|
||||
print '</div></div></div>';
|
||||
print '<div></div></div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ if ($result > 0)
|
||||
* Liste des factures
|
||||
*/
|
||||
$allow_delete = 1 ;
|
||||
$sql = 'SELECT f.rowid as ref, f.facnumber as ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid';
|
||||
$sql = 'SELECT f.rowid, f.ref, f.ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.rowid as socid';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid';
|
||||
$sql .= ' AND pf.fk_paiementfourn = '.$object->id;
|
||||
|
||||
@ -90,7 +90,7 @@ if ($socid > 0)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,";
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.ref_supplier, 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_fourn as f,".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
@ -85,6 +85,7 @@ alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text;
|
||||
alter table llx_societe_address CHANGE COLUMN ville town text;
|
||||
alter table llx_societe_address CHANGE COLUMN cp zip varchar(10);
|
||||
alter table llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer;
|
||||
alter table llx_facture_fourn CHANGE COLUMN facnumber ref_supplier varchar(30);
|
||||
|
||||
ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description;
|
||||
|
||||
@ -208,5 +209,3 @@ ALTER TABLE llx_user ADD COLUMN town varchar(50);
|
||||
ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0;
|
||||
ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0;
|
||||
|
||||
|
||||
ALTER TABLE llx_user_clicktodial ADD COLUMN url varchar(255);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user