*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1433,6 +1434,18 @@ else if ($id || $ref)
$entrepot = new Entrepot($db);
$entrepot->fetch($lines[$i]->entrepot_id);
print $entrepot->getNomUrl(1);
+ }
+ else if (count($lines[$i]->details_entrepot) > 1)
+ {
+ $detail = '';
+ foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
+ if ($detail_entrepot->entrepot_id > 0) {
+ $entrepot = new Entrepot($db);
+ $entrepot->fetch($detail_entrepot->entrepot_id);
+ $detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'
';
+ }
+ }
+ print $form->textwithtooltip($langs->trans("DetailWarehouseNumber"),$detail);
}
print '';
}
@@ -1440,6 +1453,7 @@ else if ($id || $ref)
// Batch number managment
if (! empty($conf->productbatch->enabled)) {
if (isset($lines[$i]->detail_batch) ) {
+ $flagBatch = true;
print '';
$detail = '';
foreach ($lines[$i]->detail_batch as $dbatch) {
@@ -1526,10 +1540,17 @@ else if ($id || $ref)
print 'id.'&action=classifybilled">'.$langs->trans($label).'';
}
}
-
+
if ($user->rights->expedition->supprimer)
{
- print 'id.'&action=delete">'.$langs->trans("Delete").'';
+ if (empty($conf->productbatch->enabled) || (!empty($conf->productbatch->enabled) && !$conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !isset($flagBatch))
+ {
+ print 'id.'&action=delete">'.$langs->trans("Delete").'';
+ }
+ else
+ {
+ print ''.$langs->trans('Delete').'';
+ }
}
print '';
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index d929dd067ef..019ef22f769 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -7,6 +7,7 @@
* Copyright (C) 2013 Florian Henry
* Copyright (C) 2014 Cedric GROSS
* Copyright (C) 2014 Marcos García
+ * Copyright (C) 2014 Francis Appels
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1068,7 +1069,7 @@ class Expedition extends CommonObject
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
$sql.= " WHERE ed.fk_expedition = ".$this->id;
$sql.= " AND ed.fk_origin_line = cd.rowid";
- $sql.= " ORDER BY cd.rang";
+ $sql.= " ORDER BY cd.rang, ed.fk_origin_line";
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1078,6 +1079,8 @@ class Expedition extends CommonObject
$num = $this->db->num_rows($resql);
$i = 0;
+ $lineindex = 0;
+ $originline = 0;
$this->total_ht = 0;
$this->total_tva = 0;
@@ -1087,13 +1090,25 @@ class Expedition extends CommonObject
while ($i < $num)
{
- $line = new ExpeditionLigne($this->db);
- $obj = $this->db->fetch_object($resql);
-
+ $obj = $this->db->fetch_object($resql);
+
+ if ($originline == $obj->fk_origin_line) {
+ $line->entrepot_id = 0; // entrepod_id in details_entrepot
+ $line->qty_shipped += $obj->qty_shipped;
+ } else {
+ $line = new ExpeditionLigne($this->db);
+ $line->entrepot_id = $obj->fk_entrepot;
+ $line->qty_shipped = $obj->qty_shipped;
+ }
+
+ $detail_entrepot = new stdClass;
+ $detail_entrepot->entrepot_id = $obj->fk_entrepot;
+ $detail_entrepot->qty_shipped = $obj->qty_shipped;
+ $line->details_entrepot[] = $detail_entrepot;
+
$line->line_id = $obj->line_id;
$line->fk_origin_line = $obj->fk_origin_line;
$line->origin_line_id = $obj->fk_origin_line; // TODO deprecated
- $line->entrepot_id = $obj->fk_entrepot;
$line->fk_product = $obj->fk_product;
$line->fk_product_type = $obj->fk_product_type;
$line->ref = $obj->product_ref; // TODO deprecated
@@ -1103,7 +1118,6 @@ class Expedition extends CommonObject
$line->label = $obj->custom_label;
$line->description = $obj->description;
$line->qty_asked = $obj->qty_asked;
- $line->qty_shipped = $obj->qty_shipped;
$line->weight = $obj->weight;
$line->weight_units = $obj->weight_units;
$line->length = $obj->length;
@@ -1116,7 +1130,7 @@ class Expedition extends CommonObject
// For invoicing
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type); // We force type to 0
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
- $line->qty = $obj->qty_shipped;
+ $line->qty = $line->qty_shipped;
$line->total_ht = $tabprice[0];
$line->total_localtax1 = $tabprice[9];
$line->total_localtax2 = $tabprice[10];
@@ -1141,11 +1155,25 @@ class Expedition extends CommonObject
* May be conf is not well initialized for dark reason
*/
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
- $line->detail_batch=ExpeditionLigneBatch::FetchAll($this->db,$obj->line_id);
+ if ($originline != $obj->fk_origin_line) {
+ $line->detail_batch = ExpeditionLigneBatch::FetchAll($this->db,$obj->line_id);
+ } else {
+ $line->detail_batch = array_merge($line->detail_batch,ExpeditionLigneBatch::FetchAll($this->db,$obj->line_id));
+ }
+ }
+ if ($originline != $obj->fk_origin_line) {
+ $this->lines[$lineindex] = $line;
+ $lineindex++;
+ } else {
+ $line->total_ht += $tabprice[0];
+ $line->total_localtax1 += $tabprice[9];
+ $line->total_localtax2 += $tabprice[10];
+ $line->total_ttc += $tabprice[2];
+ $line->total_tva += $tabprice[1];
}
- $this->lines[$i] = $line;
$i++;
+ $originline = $obj->fk_origin_line;
}
$this->db->free($resql);
return 1;
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index cbfa35f4c11..840151b6001 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -304,6 +304,28 @@ if ($object->fetch($id))
if ($user->rights->fournisseur->commande->lire)
{
+
+
+ // TODO move to DAO class
+ // Check if there are supplier orders billable
+ $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
+ $sql2.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut';
+ $sql2.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
+ $sql2.= ', '.MAIN_DB_PREFIX.'commande_fournisseur as c';
+ $sql2.= ' WHERE c.fk_soc = s.rowid';
+ $sql2.= ' AND s.rowid = '.$object->id;
+ // Show orders with status validated, shipping started and delivered (well any order we can bill)
+ $sql2.= " AND c.fk_statut IN (5)";
+ // Find order that are not already invoiced
+ $sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
+ $resql2=$db->query($sql2);
+ if ($resql2) {
+ $orders2invoice = $db->num_rows($resql2);
+ $db->free($resql2);
+ } else {
+ setEventMessage($db->lasterror(),'errors');
+ }
+
// TODO move to DAO class
$sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
@@ -436,60 +458,66 @@ if ($object->fetch($id))
if (empty($reshook))
{
- print '';
- print ' ';
-
- if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
- {
- print ' ';
- // List of contacts
- show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
- }
-
- // Addresses list
- if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
- {
- $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
- }
-
- if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
- {
- print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
-
- // List of todo actions
- show_actions_todo($conf,$langs,$db,$object);
-
- // List of done actions
- show_actions_done($conf,$langs,$db,$object);
- }
+ print '';
+
+ if ($user->rights->fournisseur->commande->creer)
+ {
+ $langs->load("orders");
+ print ' '.$langs->trans("AddOrder").'';
}
+
+ if ($user->rights->fournisseur->facture->creer)
+ {
+ $langs->load("bills");
+ print ' '.$langs->trans("AddBill").'';
+ }
+
+ if ($user->rights->fournisseur->facture->creer)
+ {
+ if (! empty($orders2invoice) && $orders2invoice > 0) print ' ';
+ else print ' ';
+ }
+
+ // Add action
+ if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
+ {
+ if ($user->rights->agenda->myactions->create)
+ {
+ print ' '.$langs->trans("AddAction").'';
+ }
+ else
+ {
+ print ' '.$langs->trans("AddAction").'';
+ }
+ }
+
+ print ' ';
+ print ' ';
+
+ if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
+ {
+ print ' ';
+ // List of contacts
+ show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
+ }
+
+ // Addresses list
+ if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
+ {
+ $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
+ }
+
+ if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
+ {
+ print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
+
+ // List of todo actions
+ show_actions_todo($conf,$langs,$db,$object);
+
+ // List of done actions
+ show_actions_done($conf,$langs,$db,$object);
+ }
+}
}
else
{
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index a2aa48351b0..58abe457831 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -51,6 +51,8 @@ $socid = GETPOST('socid','int');
$sortorder = GETPOST('sortorder','alpha');
$sortfield = GETPOST('sortfield','alpha');
+$viewstatut=GETPOST('viewstatut');
+
// Security check
$orderid = GETPOST('orderid');
if ($user->societe_id) $socid=$user->societe_id;
@@ -255,6 +257,8 @@ if ($resql)
}
print "\n";
print "\n";
+
+ print ' '.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).' ';
$db->free($resql);
}
diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php
new file mode 100644
index 00000000000..6c5ce8aa11c
--- /dev/null
+++ b/htdocs/fourn/commande/orderstoinvoice.php
@@ -0,0 +1,594 @@
+
+ * Copyright (C) 2004-2013 Laurent Destailleur
+ * Copyright (C) 2005 Marc Barilley / Ocebo
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2012 Andreu Bisquerra Gaya
+ * Copyright (C) 2012 David Rodriguez Martinez
+ * Copyright (C) 2012 Juanjo Menent
+ * Copyright (C) 2014 Florian Henry
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/fourn/commande/orderstoinvoice.php
+ * \ingroup commande
+ * \brief Page to invoice multiple supplier orders
+ */
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
+require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
+if (! empty($conf->projet->enabled)) {
+ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
+}
+
+$langs->load('orders');
+$langs->load('deliveries');
+$langs->load('companies');
+
+if (! $user->rights->facture->creer)
+ accessforbidden();
+
+$id = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST("facid")); // For backward compatibility
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'alpha');
+$confirm = GETPOST('confirm', 'alpha');
+$sref = GETPOST('sref');
+$sref_client = GETPOST('sref_client');
+$sall = GETPOST('sall');
+$socid = GETPOST('socid', 'int');
+$selected = GETPOST('orders_to_invoice');
+$sortfield = GETPOST("sortfield", 'alpha');
+$sortorder = GETPOST("sortorder", 'alpha');
+$viewstatut = GETPOST('viewstatut');
+
+if (! $sortfield)
+ $sortfield = 'c.rowid';
+if (! $sortorder)
+ $sortorder = 'DESC';
+
+$now = dol_now();
+$date_start = dol_mktime(0, 0, 0, $_REQUEST["date_startmonth"], $_REQUEST["date_startday"], $_REQUEST["date_startyear"]); // Date for local PHP server
+$date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_endday"], $_REQUEST["date_endyear"]);
+$date_starty = dol_mktime(0, 0, 0, $_REQUEST["date_start_delymonth"], $_REQUEST["date_start_delyday"], $_REQUEST["date_start_delyyear"]); // Date for local PHP server
+$date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["date_end_delyday"], $_REQUEST["date_end_delyyear"]);
+
+if ($action == 'create') {
+ if (is_array($selected) == false) {
+ $mesgs = array (
+ '' . $langs->trans('Error_OrderNotChecked') . ' '
+ );
+ } else {
+ $origin = GETPOST('origin');
+ $originid = GETPOST('originid');
+ }
+}
+
+// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
+include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
+$hookmanager = new HookManager($db);
+$hookmanager->initHooks(array('orderstoinvoicesupplier'));
+
+/*
+ * Actions
+ */
+
+if (($action == 'create' || $action == 'add') && empty($mesgs)) {
+
+ require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php';
+ if (! empty($conf->projet->enabled))
+ require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
+
+ $langs->load('bills');
+ $langs->load('products');
+ $langs->load('main');
+ if (isset($_GET['orders_to_invoice'])) {
+ $orders_id = $_GET['orders_to_invoice'];
+ $n = count($orders_id);
+ $i = 0;
+
+ $originid = $orders_id[0];
+ $_GET['originid'] = $orders_id[0];
+ }
+ if (isset($_POST['orders_to_invoice'])) {
+ $orders_id = $_POST['orders_to_invoice'];
+ $nn = count($orders_id);
+ $ii = 0;
+
+ $originid = $orders_id[0];
+ $_POST['originid'] = $orders_id[0];
+ }
+
+ $projectid = GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0;
+ $lineid = GETPOST('lineid', 'int');
+ $userid = GETPOST('userid', 'int');
+ $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref') : GETPOST('search_ref');
+
+ // Security check
+ if ($user->societe_id)
+ $socid = $user->societe_id;
+ $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
+
+ $usehm = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
+ $object = new FactureFournisseur($db);
+
+ // Insert new invoice in database
+ if ($action == 'add' && $user->rights->fournisseur->facture->creer) {
+ $object->socid = GETPOST('socid');
+ $db->begin();
+ $error = 0;
+
+ // Standard or deposit or proforma invoice
+ $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
+ if (empty($datefacture)) {
+ $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
+ }
+ if (! $error) {
+ $object->ref = $_POST['ref'];
+ $object->ref_supplier = $_POST['ref_supplier'];
+ $object->socid = $_POST['socid'];
+ $object->libelle = $_POST['libelle'];
+ $object->date = $datefacture;
+ $object->date_echeance = $datedue;
+ $object->note_public = GETPOST('note_public');
+ $object->note_private = GETPOST('note_private');
+ $object->cond_reglement_id = GETPOST('cond_reglement_id');
+ $object->mode_reglement_id = GETPOST('mode_reglement_id');
+ $projectid = GETPOST('projectid');
+ if ($projectid > 0)
+ $object->fk_project = $projectid;
+
+ // Auto calculation of date due if not filled by user
+ if (empty($object->date_echeance))
+ $object->date_echeance = $object->calculate_date_lim_reglement();
+
+ if ($_POST['origin'] && $_POST['originid']) {
+ $object->origin = $_POST['origin'];
+ $object->origin_id = $orders_id[$ii];
+ $object->linked_objects = $orders_id;
+ $id = $object->create($user);
+
+ if ($id > 0) {
+ foreach ( $orders_id as $origin => $origin_id ) {
+ $origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id);
+ $db->begin();
+ $sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element (";
+ $sql .= "fk_source";
+ $sql .= ", sourcetype";
+ $sql .= ", fk_target";
+ $sql .= ", targettype";
+ $sql .= ") VALUES (";
+ $sql .= $origin_id;
+ $sql .= ", '" . $object->origin . "'";
+ $sql .= ", " . $id;
+ $sql .= ", '" . $object->element . "'";
+ $sql .= ")";
+
+ if ($db->query($sql)) {
+ $db->commit();
+ } else {
+ $db->rollback();
+ }
+ }
+
+ while ( $ii < $nn ) {
+ $objectsrc = new CommandeFournisseur($db);
+ dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
+ $result = $objectsrc->fetch($orders_id[$ii]);
+ if ($result > 0) {
+ $lines = $objectsrc->lines;
+ if (empty($lines) && method_exists($objectsrc, 'fetch_lines')) {
+ $objectsrc->fetch_lines();
+ $lines = $objectsrc->lines;
+ }
+ $fk_parent_line = 0;
+ $num = count($lines);
+ for($i = 0; $i < $num; $i ++) {
+ $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
+
+ $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
+ $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
+
+ // Dates
+ // TODO mutualiser
+ $date_start = $lines[$i]->date_debut_prevue;
+ if ($lines[$i]->date_debut_reel)
+ $date_start = $lines[$i]->date_debut_reel;
+ if ($lines[$i]->date_start)
+ $date_start = $lines[$i]->date_start;
+ $date_end = $lines[$i]->date_fin_prevue;
+ if ($lines[$i]->date_fin_reel)
+ $date_end = $lines[$i]->date_fin_reel;
+ if ($lines[$i]->date_end)
+ $date_end = $lines[$i]->date_end;
+
+ // Reset fk_parent_line for no child products and special product
+ if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
+ $fk_parent_line = 0;
+ }
+ // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
+ $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, 'HT', $product_type);
+
+ if ($result > 0) {
+ $lineid = $result;
+ } else {
+ $lineid = 0;
+ $error ++;
+ break;
+ }
+ // Defined the new fk_parent_line
+ if ($result > 0 && $lines[$i]->product_type == 9) {
+ $fk_parent_line = $result;
+ }
+ }
+ } else {
+ $mesgs[] = $objectsrc->error;
+ $error ++;
+ }
+ $ii ++;
+ }
+ } else {
+ $mesgs[] = $object->error;
+ $error ++;
+ }
+ }
+ }
+
+ // End of object creation, we show it
+ if ($id > 0 && ! $error) {
+ $db->commit();
+ header('Location: ' . DOL_URL_ROOT . '/fourn/facture/fiche.php?facid=' . $id);
+ exit();
+ } else {
+ $db->rollback();
+ $action = 'create';
+ $_GET["origin"] = $_POST["origin"];
+ $_GET["originid"] = $_POST["originid"];
+ $mesgs[] = '' . $object->error . ' ';
+ }
+ }
+}
+
+/*
+ * View
+ */
+
+$html = new Form($db);
+$htmlother = new FormOther($db);
+$formfile = new FormFile($db);
+$companystatic = new Societe($db);
+
+// Mode creation
+if ($action == 'create' && empty($mesgs)) {
+
+ llxHeader();
+ print_fiche_titre($langs->trans('NewBill'));
+
+ $soc = new Societe($db);
+ if ($socid)
+ $res = $soc->fetch($socid);
+ if ($res) {
+ $cond_reglement_id = $soc->cond_reglement_id;
+ $mode_reglement_id = $soc->mode_reglement_id;
+ }
+ $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : '';
+
+ print '\n";
+
+ print ' |