$facturefournstatic->ref = $ref; $facturefournstatic->id = $obj->objid; $facturefournstatic->type = $obj->type; $ref = $facturefournstatic->getNomUrl(1, ''); $societestatic->id = $obj->socid; $societestatic->name = $obj->name; $refcomp = $societestatic->getNomUrl(1, '', 24); $paiement = -1 * $facturefournstatic->getSommePaiement(); // Payment already done } } if ($obj->family == 'invoice') { $facturestatic->ref = $obj->ref; $facturestatic->id = $obj->objid; $facturestatic->type = $obj->type; $ref = $facturestatic->getNomUrl(1, ''); $societestatic->id = $obj->socid; $societestatic->name = $obj->name; $refcomp = $societestatic->getNomUrl(1, '', 24); $paiement = $facturestatic->getSommePaiement(); // Payment already done } if ($obj->family == 'social_contribution') { $socialcontribstatic->ref = $obj->ref; $socialcontribstatic->id = $obj->objid; $socialcontribstatic->lib = $obj->type; $ref = $socialcontribstatic->getNomUrl(1, 24); $paiement = -1 * $socialcontribstatic->getSommePaiement(); // Payment already done } $total_ttc = $obj->total_ttc;
print '<td>' . $langs->trans("ThirdParty") . '</td>'; print '<td>' . $langs->trans("RIB") . '</td>'; print '<td>' . $langs->trans("RUM") . '</td>'; print '<td align="right">' . $langs->trans("AmountTTC") . '</td>'; print '<td align="right">' . $langs->trans("DateRequest") . '</td>'; print '</tr>'; if ($num) { $var = True; while ($i < $num && $i < 20) { $obj = $db->fetch_object($resql); $var = !$var; print '<tr ' . $bc[$var] . '>'; print '<td>'; $invoicestatic->id = $obj->rowid; $invoicestatic->ref = $obj->facnumber; print $invoicestatic->getNomUrl(1, 'withdraw'); print '</td>'; // Thirdparty print '<td>'; $thirdpartystatic->fetch($obj->socid); print $thirdpartystatic->getNomUrl(1, 'card'); print '</td>'; // RIB print '<td>'; print $thirdpartystatic->display_rib(); print '</td>'; // RUM print '<td>'; print $thirdpartystatic->display_rib('rum'); print '</td>'; // Amount
if ($num > 0) { $var = True; while ($i < $num) { $objp = $db->fetch_object($resql); $var = !$var; print '<tr ' . $bc[$var] . '>'; $invoice = new Facture($db); $invoice->fetch($objp->facid); $paiement = $invoice->getSommePaiement(); $creditnotes = $invoice->getSumCreditNotesUsed(); $deposits = $invoice->getSumDepositsUsed(); $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); // Invoice print '<td>'; print $invoice->getNomUrl(1); print "</td>\n"; // Third party print '<td>'; $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; print $thirdpartystatic->getNomUrl(1); print '</td>'; // Expected to pay print '<td align="right">' . price($objp->total_ttc) . '</td>'; // Amount payed print '<td align="right">' . price($objp->amount) . '</td>'; // Remain to pay print '<td align="right">' . price($remaintopay) . '</td>'; // Status print '<td align="right">' . $invoice->getLibStatut(5, $alreadypayed) . '</td>';
$twiiit->load($PDOdb, $obj->rowid); $Tab[] = array('link' => $twiiit->getNomUrl(), 'text' => $twiiit->getComment()); } } else { if ($type_tag == 'hashtag') { $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "propal WHERE ref = '" . $db->escape($tag) . "'"); while ($obj = $db->fetch_object($res)) { $o = new Propal($db); $o->fetch($obj->rowid); $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'user'); } $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "facture WHERE facnumber = '" . $db->escape($tag) . "'"); while ($obj = $db->fetch_object($res)) { $o = new Facture($db); $o->fetch($obj->rowid); $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'societe'); } $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "product WHERE ref = '" . $db->escape($tag) . "'"); while ($obj = $db->fetch_object($res)) { $o = new Product($db); $o->fetch($obj->rowid); $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'societe'); } } else { } } } if (count($Tab) == 1) { preg_match_all('/<a[^>]+href=([\'"])(.+?)\\1[^>]*>/i', $Tab[0]['link0'], $match); if (!empty($match[2][0])) { header('location:' . $match[2][0]);
$i=0; foreach($facidavoir as $id) { if ($i==0) print ' '; else print ','; $facavoir=new Facture($db); $facavoir->fetch($id); print $facavoir->getNomUrl(1); } print ')'; } if ($facidnext > 0) { $facthatreplace=new Facture($db); $facthatreplace->fetch($facidnext); print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; } print '</td></tr>'; // Discounts print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); else print $langs->trans("CompanyHasNoRelativeDiscount"); print '. '; if ($absolute_discount > 0) { if ($fac->statut > 0 || $fac->type == 2 || $fac->type == 3) { if ($fac->statut == 0) { print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie)).'. ';
$resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; $invoice = new Facture($db); while ($i < $num) { $obj = $db->fetch_object($resql); $invoice->fetch($obj->fk_facture_source); print '<tr><td colspan="' . $nbcols . '" align="right">'; if ($invoice->type == Facture::TYPE_CREDIT_NOTE) { print $langs->trans("CreditNote") . ' '; } if ($invoice->type == Facture::TYPE_DEPOSIT) { print $langs->trans("Deposit") . ' '; } print $invoice->getNomUrl(0); print ' :</td>'; print '<td align="right">' . price($obj->amount_ttc) . '</td>'; print '<td align="right">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=unlinkdiscount&discountid=' . $obj->rowid . '">' . img_delete() . '</a>'; print '</td></tr>'; $i++; if ($invoice->type == Facture::TYPE_CREDIT_NOTE) { $creditnoteamount += $obj->amount_ttc; } if ($invoice->type == Facture::TYPE_DEPOSIT) { $depositamount += $obj->amount_ttc; } } } else { dol_print_error($db);
$var = false; $num = $db->num_rows($resql); print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print '<td colspan="3">' . $langs->trans("CustomersDraftInvoices") . ($num ? ' (' . $num . ')' : '') . '</td></tr>'; if ($num) { $companystatic = new Societe($db); $i = 0; $tot_ttc = 0; while ($i < $num) { $obj = $db->fetch_object($resql); print '<tr ' . $bc[$var] . '><td class="nowrap">'; $facturestatic->ref = $obj->facnumber; $facturestatic->id = $obj->rowid; $facturestatic->type = $obj->type; print $facturestatic->getNomUrl(1, ''); print '</td>'; print '<td class="nowrap">'; $companystatic->id = $obj->socid; $companystatic->nom = $obj->nom; $companystatic->client = 1; print $companystatic->getNomUrl(1, '', 16); print '</td>'; print '<td align="right" class="nowrap">' . price($obj->total_ttc) . '</td>'; print '</tr>'; $tot_ttc += $obj->total_ttc; $i++; $var = !$var; } print '<tr class="liste_total"><td align="left">' . $langs->trans("Total") . '</td>'; print '<td colspan="2" align="right">' . price($tot_ttc) . '</td>';
print "<td align='right'>" . $langs->trans("Credit") . "</td>"; print "</tr>\n"; $var = true; $r = ''; $invoicestatic = new Facture($db); $companystatic = new Client($db); foreach ($tabfac as $key => $val) { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; $date = dol_print_date($db->jdate($val["date"]), 'day'); // Third party foreach ($tabttc[$key] as $k => $mt) { print "<tr " . $bc[$var] . ">"; print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; print "<td>" . length_accounta($k); print "</td><td>" . $langs->trans("ThirdParty"); print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')'; print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(-$mt) : '') . "</td>"; } print "</tr>"; // Product / Service foreach ($tabht[$key] as $k => $mt) { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k); if ($mt) {
/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ function loadBox($max = 5) { global $conf, $user, $langs, $db; $this->max = $max; include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; $facturestatic = new Facture($db); $societestatic = new Societe($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $max)); if ($user->rights->facture->lire) { $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql .= " s.code_client,"; $sql .= " s.logo,"; $sql .= " f.facnumber, f.date_lim_reglement as datelimite,"; $sql .= " f.type,"; $sql .= " f.amount, f.datef as df,"; $sql .= " f.total as total_ht,"; $sql .= " f.tva as total_tva,"; $sql .= " f.total_ttc,"; $sql .= " f.paye, f.fk_statut, f.rowid as facid"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s," . MAIN_DB_PREFIX . "facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.entity = " . $conf->entity; $sql .= " AND f.paye = 0"; $sql .= " AND fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id; } //$sql.= " ORDER BY f.datef DESC, f.facnumber DESC "; $sql .= " ORDER BY datelimite ASC, f.facnumber ASC "; $sql .= $db->plimit($max, 0); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $now = dol_now(); $line = 0; $l_due_date = $langs->trans('Late') . ' (' . strtolower($langs->trans('DateEcheance')) . ': %s)'; while ($line < $num) { $objp = $db->fetch_object($result); $datelimite = $db->jdate($objp->datelimite); $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->facnumber; $facturestatic->type = $objp->type; $facturestatic->total_ht = $objp->total_ht; $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; $societestatic->id = $objp->socid; $societestatic->name = $objp->name; $societestatic->client = 1; $societestatic->code_client = $objp->code_client; $societestatic->logo = $objp->logo; $late = ''; if ($datelimite < $now - $conf->facture->client->warning_delay) { $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day'))); } $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $facturestatic->getNomUrl(1), 'text2' => $late, 'asis' => 1); $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $societestatic->getNomUrl(1, '', 44), 'asis' => 1); $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency)); $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => dol_print_date($datelimite, 'day')); $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3)); $line++; } if ($num == 0) { $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoUnpaidCustomerBills")); } $db->free($result); } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql); } } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed")); } }
/** * Create a withdraw * TODO delete params banque and agence when not necesary * * @param int $banque dolibarr mysoc bank * @param int $agence dolibarr mysoc bank office (guichet) * @param string $mode real=do action, simu=test only * @return int <0 if KO, nbre of invoice withdrawed if OK */ function Create($banque = 0, $agence = 0, $mode = 'real') { global $conf, $langs; dol_syslog(get_class($this) . "::Create banque={$banque} agence={$agence}"); require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; $error = 0; $datetimeprev = time(); $month = strftime("%m", $datetimeprev); $year = strftime("%Y", $datetimeprev); $puser = new User($this->db, $conf->global->PRELEVEMENT_USER); /* * Read invoices */ $factures = array(); $factures_prev = array(); $factures_result = array(); $factures_prev_id = array(); $factures_errors = array(); if (!$error) { $sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc"; $sql .= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib"; $sql .= ", pfd.amount"; $sql .= ", s.nom as name"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; $sql .= ", " . MAIN_DB_PREFIX . "societe as s"; $sql .= ", " . MAIN_DB_PREFIX . "prelevement_facture_demande as pfd"; //if ($banque || $agence) $sql.= ", ".MAIN_DB_PREFIX."societe_rib as sr"; $sql .= " WHERE f.rowid = pfd.fk_facture"; $sql .= " AND f.entity = " . $conf->entity; $sql .= " AND s.rowid = f.fk_soc"; //if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc"; $sql .= " AND f.fk_statut = 1"; $sql .= " AND f.paye = 0"; $sql .= " AND pfd.traite = 0"; $sql .= " AND f.total_ttc > 0"; //if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; dol_syslog(get_class($this) . "::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); $i = 0; while ($i < $num) { $row = $this->db->fetch_row($resql); $factures[$i] = $row; // All fields $i++; } $this->db->free($resql); dol_syslog($i . " invoices to withdraw"); } else { $error = 1; dol_syslog("Erreur -1"); dol_syslog($this->db->error()); } } if (!$error) { require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $soc = new Societe($this->db); // Check RIB $i = 0; dol_syslog("Start RIB check"); if (count($factures) > 0) { foreach ($factures as $key => $fac) { $fact = new Facture($this->db); if ($fact->fetch($fac[0]) >= 0) { if ($soc->fetch($fact->socid) >= 0) { $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $soc->id); if ($bac->verif() >= 1) { $factures_prev[$i] = $fac; /* second tableau necessaire pour BonPrelevement */ $factures_prev_id[$i] = $fac[0]; $i++; } else { dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() " . $fact->socid . " " . $soc->name, LOG_ERR); $this->invoice_in_error[$fac[0]] = "Error on default bank number RIB/IBAN for invoice " . $fact->getNomUrl(0) . " for thirdparty (reported by function verif) " . $soc->name; } } else { dol_syslog("Failed to read company", LOG_ERR); } } else { dol_syslog("Failed to read invoice", LOG_ERR); } } } else { dol_syslog("No invoice to process"); } } $ok = 0; // Withdraw invoices in factures_prev array $out = count($factures_prev) . " invoices will be withdrawn."; //print $out."\n"; dol_syslog($out); if (count($factures_prev) > 0) { if ($mode == 'real') { $ok = 1; } else { print $langs->trans("ModeWarning"); //"Option for real mode was not set, we stop after this simulation\n"; } } if ($ok) { /* * We are in real mode. * We create withdraw receipt and build withdraw into disk */ $this->db->begin(); $now = dol_now(); /* * Traitements */ if (!$error) { $ref = substr($year, -2) . $month; $sql = "SELECT substring(ref from char_length(ref) - 1)"; $sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons"; $sql .= " WHERE ref LIKE '%" . $ref . "%'"; $sql .= " AND entity = " . $conf->entity; $sql .= " ORDER BY ref DESC LIMIT 1"; dol_syslog(get_class($this) . "::Create sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $row = $this->db->fetch_row($resql); } else { $error++; dol_syslog("Erreur recherche reference"); } $ref = "T" . $ref . str_pad(dol_substr("00" . intval($row[0]) + 1, 0, 2), 2, "0", STR_PAD_LEFT); $this->filename = $conf->prelevement->dir_output . '/receipts/' . $ref . '.xml'; // Create withdraw receipt in database $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons ("; $sql .= " ref, entity, datec"; $sql .= ") VALUES ("; $sql .= "'" . $this->db->escape($ref) . "'"; $sql .= ", " . $conf->entity; $sql .= ", '" . $this->db->idate($now) . "'"; $sql .= ")"; dol_syslog(get_class($this) . "::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons"); $dir = $conf->prelevement->dir_output . '/receipts'; $file = $filebonprev; if (!is_dir($dir)) { dol_mkdir($dir); } } else { $error++; dol_syslog("Erreur creation du bon de prelevement"); } } /* * Create withdrawal receipt */ if (!$error) { if (count($factures_prev) > 0) { foreach ($factures_prev as $fac) { // Fetch invoice $fact = new Facture($this->db); $fact->fetch($fac[0]); /* * Add standing order * * * $fac[3] : banque * $fac[4] : guichet * $fac[5] : number * $fac[6] : cle rib * $fac[7] : amount * $fac[8] : client nom * $fac[2] : client id */ $ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]); if ($ri != 0) { $error++; } // Update invoice requests as done $sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_facture_demande"; $sql .= " SET traite = 1"; $sql .= ", date_traite = '" . $this->db->idate($now) . "'"; $sql .= ", fk_prelevement_bons = " . $this->id; $sql .= " WHERE rowid = " . $fac[1]; dol_syslog(get_class($this) . "::Create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error++; dol_syslog("Erreur mise a jour des demandes"); dol_syslog($this->db->error()); } } } } if (!$error) { /* * Withdraw receipt */ dol_syslog("Debut prelevement - Nombre de factures " . count($factures_prev)); if (count($factures_prev) > 0) { $this->date_echeance = $datetimeprev; $this->reference_remise = $ref; $this->numero_national_emetteur = $conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR; $this->raison_sociale = $conf->global->PRELEVEMENT_RAISON_SOCIALE; $this->emetteur_code_banque = $conf->global->PRELEVEMENT_CODE_BANQUE; $this->emetteur_code_guichet = $conf->global->PRELEVEMENT_CODE_GUICHET; $this->emetteur_numero_compte = $conf->global->PRELEVEMENT_NUMERO_COMPTE; $this->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY; $this->emetteur_iban = $conf->global->PRELEVEMENT_IBAN; $this->emetteur_bic = $conf->global->PRELEVEMENT_BIC; $this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // TODO Add this into setup of admin/prelevement.php. Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; $this->factures = $factures_prev_id; // Generation of SEPA file $this->generate(); } dol_syslog($filebonprev); dol_syslog("Fin prelevement"); } /* * Update total */ $sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons"; $sql .= " SET amount = " . price2num($this->total); $sql .= " WHERE rowid = " . $this->id; $sql .= " AND entity = " . $conf->entity; dol_syslog(get_class($this) . "::Create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error++; dol_syslog("Erreur mise a jour du total - {$sql}"); } if (!$error) { $this->db->commit(); } else { $this->db->rollback(); dol_syslog("Error", LOG_ERR); } return count($factures_prev); } else { return 0; } }
/** * Show html area with actions done * * @param Conf $conf Object conf * @param Translate $langs Object langs * @param DoliDB $db Object db * @param Object $object Object third party or member * @param Contact $objcon Object contact * @param int $noprint Return string but does not output it * @return mixed Return html part or void if noprint is 1 * TODO change function to be able to list event linked to an object. */ function show_actions_done($conf, $langs, $db, $object, $objcon = '', $noprint = 0) { global $bc, $user; // Check parameters if (!is_object($object)) { dol_print_error('', 'BadParameter'); } $out = ''; $histo = array(); $numaction = 0; $now = dol_now('tzuser'); if (!empty($conf->agenda->enabled)) { // Recherche histo sur actioncomm $sql = "SELECT a.id, a.label,"; $sql .= " a.datep as dp,"; $sql .= " a.datep2 as dp2,"; $sql .= " a.note, a.percent,"; $sql .= " a.fk_element, a.elementtype,"; $sql .= " a.fk_user_author, a.fk_contact,"; $sql .= " c.code as acode, c.libelle,"; $sql .= " u.login, u.rowid as user_id"; if (get_class($object) == 'Adherent') { $sql .= ", m.lastname, m.firstname"; } if (get_class($object) == 'Societe') { $sql .= ", sp.lastname, sp.firstname"; } $sql .= " FROM " . MAIN_DB_PREFIX . "c_actioncomm as c, " . MAIN_DB_PREFIX . "user as u, " . MAIN_DB_PREFIX . "actioncomm as a"; if (get_class($object) == 'Adherent') { $sql .= ", " . MAIN_DB_PREFIX . "adherent as m"; } if (get_class($object) == 'Societe') { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople as sp ON a.fk_contact = sp.rowid"; } $sql .= " WHERE u.rowid = a.fk_user_author"; $sql .= " AND a.entity IN (" . getEntity('agenda', 1) . ")"; if (get_class($object) == 'Adherent') { $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; } if (get_class($object) == 'Adherent' && $object->id) { $sql .= " AND a.fk_element = " . $object->id; } if (get_class($object) == 'Societe' && $object->id) { $sql .= " AND a.fk_soc = " . $object->id; } if (is_object($objcon) && $objcon->id) { $sql .= " AND a.fk_contact = " . $objcon->id; } $sql .= " AND c.id=a.fk_action"; $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '" . $db->idate($now) . "'))"; $sql .= " ORDER BY a.datep DESC, a.id DESC"; dol_syslog("company.lib::show_actions_done sql=" . $sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $i = 0; $num = $db->num_rows($resql); $var = true; while ($i < $num) { $obj = $db->fetch_object($resql); $histo[$numaction] = array('type' => 'action', 'id' => $obj->id, 'datestart' => $db->jdate($obj->dp), 'date' => $db->jdate($obj->dp2), 'note' => $obj->label, 'percent' => $obj->percent, 'acode' => $obj->acode, 'libelle' => $obj->libelle, 'userid' => $obj->user_id, 'login' => $obj->login, 'contact_id' => $obj->fk_contact, 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'fk_element' => $obj->fk_element, 'elementtype' => $obj->elementtype); $numaction++; $i++; } } else { dol_print_error($db); } } if (!empty($conf->mailing->enabled) && !empty($objcon->email)) { $langs->load("mails"); // Recherche histo sur mailing $sql = "SELECT m.rowid as id, mc.date_envoi as da, m.titre as note, '100' as percentage,"; $sql .= " 'AC_EMAILING' as acode,"; $sql .= " u.rowid as user_id, u.login"; // User that valid action $sql .= " FROM " . MAIN_DB_PREFIX . "mailing as m, " . MAIN_DB_PREFIX . "mailing_cibles as mc, " . MAIN_DB_PREFIX . "user as u"; $sql .= " WHERE mc.email = '" . $db->escape($objcon->email) . "'"; // Search is done on email. $sql .= " AND mc.statut = 1"; $sql .= " AND u.rowid = m.fk_user_valid"; $sql .= " AND mc.fk_mailing=m.rowid"; $sql .= " ORDER BY mc.date_envoi DESC, m.rowid DESC"; dol_syslog("company.lib::show_actions_done sql=" . $sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $i = 0; $num = $db->num_rows($resql); $var = true; while ($i < $num) { $obj = $db->fetch_object($resql); $histo[$numaction] = array('type' => 'mailing', 'id' => $obj->id, 'date' => $db->jdate($obj->da), 'note' => $obj->note, 'percent' => $obj->percentage, 'acode' => $obj->acode, 'userid' => $obj->user_id, 'login' => $obj->login); $numaction++; $i++; } $db->free($resql); } else { dol_print_error($db); } } if (!empty($conf->agenda->enabled) || !empty($conf->mailing->enabled) && !empty($objcon->email)) { require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; $actionstatic = new ActionComm($db); $userstatic = new User($db); $contactstatic = new Contact($db); // TODO uniformize $propalstatic = new Propal($db); $orderstatic = new Commande($db); $facturestatic = new Facture($db); $out .= "\n"; $out .= '<table class="noborder" width="100%">'; $out .= '<tr class="liste_titre">'; $out .= '<td colspan="2">'; if (get_class($object) == 'Societe') { $out .= '<a href="' . DOL_URL_ROOT . '/comm/action/listactions.php?socid=' . $object->id . '&status=done">'; } $out .= $langs->trans("ActionsDoneShort"); if (get_class($object) == 'Societe') { $out .= '</a>'; } $out .= '</td>'; $out .= '<td colspan="5" align="right">'; $permok = $user->rights->agenda->myactions->create; if ((!empty($object->id) || !empty($objcon->id)) && $permok) { $out .= '<a href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create'; if (get_class($object) == 'Societe') { $out .= '&socid=' . $object->id; } $out .= (!empty($objcon->id) ? '&contactid=' . $objcon->id : '') . '&backtopage=1&percentage=-1">'; $out .= $langs->trans("AddAnAction") . ' '; $out .= img_picto($langs->trans("AddAnAction"), 'filenew'); $out .= "</a>"; } $out .= '</td>'; $out .= '</tr>'; foreach ($histo as $key => $value) { $var = !$var; $out .= "<tr " . $bc[$var] . ">"; // Champ date $out .= '<td width="120" class="nowrap">'; if ($histo[$key]['date']) { $out .= dol_print_date($histo[$key]['date'], 'dayhour'); } else { if ($histo[$key]['datestart']) { $out .= dol_print_date($histo[$key]['datestart'], 'dayhour'); } } $out .= "</td>\n"; // Picto $out .= '<td width="16"> </td>'; // Action $out .= '<td>'; if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') { $actionstatic->type_code = $histo[$key]['acode']; $transcode = $langs->trans("Action" . $histo[$key]['acode']); $libelle = $transcode != "Action" . $histo[$key]['acode'] ? $transcode : $histo[$key]['libelle']; //$actionstatic->libelle=$libelle; $actionstatic->libelle = $histo[$key]['note']; $actionstatic->id = $histo[$key]['id']; $out .= $actionstatic->getNomUrl(1, 40); } if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') { $out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/fiche.php?id=' . $histo[$key]['id'] . '">' . img_object($langs->trans("ShowEMailing"), "email") . ' '; $transcode = $langs->trans("Action" . $histo[$key]['acode']); $libelle = $transcode != "Action" . $histo[$key]['acode'] ? $transcode : 'Send mass mailing'; $out .= dol_trunc($libelle, 40); } $out .= '</td>'; // Title of event //$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>'; // Objet lie // TODO uniformize $out .= '<td>'; if (isset($histo[$key]['elementtype'])) { if ($histo[$key]['elementtype'] == 'propal' && !empty($conf->propal->enabled)) { $propalstatic->ref = $langs->trans("ProposalShort"); $propalstatic->id = $histo[$key]['fk_element']; $out .= $propalstatic->getNomUrl(1); } elseif ($histo[$key]['elementtype'] == 'commande' && !empty($conf->commande->enabled)) { $orderstatic->ref = $langs->trans("Order"); $orderstatic->id = $histo[$key]['fk_element']; $out .= $orderstatic->getNomUrl(1); } elseif ($histo[$key]['elementtype'] == 'facture' && !empty($conf->facture->enabled)) { $facturestatic->ref = $langs->trans("Invoice"); $facturestatic->id = $histo[$key]['fk_element']; $facturestatic->type = $histo[$key]['ftype']; $out .= $facturestatic->getNomUrl(1, 'compta'); } else { $out .= ' '; } } else { $out .= ' '; } $out .= '</td>'; // Contact pour cette action if (!empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) { $contactstatic->lastname = $histo[$key]['lastname']; $contactstatic->firstname = $histo[$key]['firstname']; $contactstatic->id = $histo[$key]['contact_id']; $out .= '<td width="120">' . $contactstatic->getNomUrl(1, '', 10) . '</td>'; } else { $out .= '<td> </td>'; } // Auteur $out .= '<td class="nowrap" width="80">'; $userstatic->id = $histo[$key]['userid']; $userstatic->login = $histo[$key]['login']; $out .= $userstatic->getLoginUrl(1); $out .= '</td>'; // Statut $out .= '<td class="nowrap" width="20">' . $actionstatic->LibStatut($histo[$key]['percent'], 3) . '</td>'; $out .= "</tr>\n"; $i++; } $out .= "</table>\n"; $out .= "<br>\n"; } if ($noprint) { return $out; } else { print $out; } }
$x_both[$my_coll_rate]['coll']['detail'][] = array( 'id' =>$x_coll[$my_coll_rate]['facid'][$id], 'descr' =>$x_coll[$my_coll_rate]['descr'][$id], 'pid' =>$x_coll[$my_coll_rate]['pid'][$id], 'pref' =>$x_coll[$my_coll_rate]['pref'][$id], 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id], 'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id], 'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id], 'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id], 'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id], 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id], 'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id], 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id], 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id], 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id], 'link' =>$invoice_customer->getNomUrl(1,'',12)); } } // tva paid foreach(array_keys($x_paye) as $my_paye_rate){ $x_both[$my_paye_rate]['paye']['totalht'] = $x_paye[$my_paye_rate]['totalht']; $x_both[$my_paye_rate]['paye']['vat'] = $x_paye[$my_paye_rate]['vat']; if(!isset($x_both[$my_paye_rate]['coll']['totalht'])){ $x_both[$my_paye_rate]['coll']['totalht'] = 0; $x_both[$my_paye_rate]['coll']['vat'] = 0; } $x_both[$my_paye_rate]['paye']['links'] = ''; $x_both[$my_paye_rate]['paye']['detail'] = array(); foreach($x_paye[$my_paye_rate]['facid'] as $id=>$dummy) {
if ($resql) { $var = true; $num = $db->num_rows($resql); // 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(); $userstatic->id = $objf->userid; $userstatic->login = $objf->login; $TData[] = array('date' => $fac->date, 'link' => $fac->getNomUrl(1), 'status' => $fac->getLibStatut(2, $totalpaye), 'amount' => $fac->total_ttc, 'author' => $userstatic->getLoginUrl(1)); $TDataSort[] = $fac->date; // 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; $sql .= " ORDER BY p.datep ASC"; $resqlp = $db->query($sql); if ($resqlp) { $nump = $db->num_rows($resqlp); $j = 0;
$facusing->fetch($object->fk_facture_source); print ' (' . $langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)) . ')'; } $facidavoir = $object->getListIdAvoirFromInvoice(); if (count($facidavoir) > 0) { print ' (' . $langs->transnoentities("InvoiceHasAvoir"); $i = 0; foreach ($facidavoir as $id) { if ($i == 0) { print ' '; } else { print ','; } $facavoir = new Facture($db); $facavoir->fetch($id); print $facavoir->getNomUrl(1); } print ')'; } /* if ($facidnext > 0) { $facthatreplace=new Facture($db); $facthatreplace->fetch($facidnext); print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; } */ print '</td></tr>'; // Discounts print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="5">'; if ($object->thirdparty->remise_percent) {
$tableaushown = 1; print '<tr class="liste_titre">'; print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastCustomersBills", $num <= $MAXLIST ? "" : $MAXLIST) . '</td><td align="right"><a href="' . DOL_URL_ROOT . '/compta/facture.php?socid=' . $objsoc->id . '">' . $langs->trans("AllBills") . ' (' . $num . ')</a></td>'; print '<td width="20px" align="right"><a href="' . DOL_URL_ROOT . '/compta/facture/stats/index.php?socid=' . $objsoc->id . '">' . img_picto($langs->trans("Statistics"), 'stats') . '</a></td>'; print '</tr></table></td>'; print '</tr>'; } while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); $var = !$var; print "<tr {$bc[$var]}>"; print '<td>'; $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->facnumber; $facturestatic->type = $objp->type; print $facturestatic->getNomUrl(1); print '</td>'; if ($objp->df > 0) { print "<td align=\"right\">" . dol_print_date($db->jdate($objp->df), 'day') . "</td>\n"; } else { print "<td align=\"right\"><b>!!!</b></td>\n"; } print "<td align=\"right\">" . price($objp->total_ttc) . "</td>\n"; print '<td align="right" nowrap="nowrap">' . $facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am) . "</td>\n"; print "</tr>\n"; $i++; } $db->free($resql); } else { dol_print_error($db); }
$total_ttc = 0; $totalrecu = 0; while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); $var = !$var; $datelimit = $db->jdate($objp->datelimite); print '<tr ' . $bc[$var] . '>'; print '<td class="nowrap">'; $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->facnumber; $facturestatic->type = $objp->type; $notetoshow = dol_string_nohtmltag($user->societe_id > 0 ? $objp->note_public : $objp->note, 1); $paiement = $facturestatic->getSommePaiement(); print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<td class="nobordernopadding nowrap">'; print $facturestatic->getNomUrl(1, '', 200, 0, $notetoshow); print $objp->increment; print '</td>'; print '<td style="min-width: 20px" class="nobordernopadding nowrap">'; if (!empty($objp->note_private)) { print ' <span class="note">'; print '<a href="' . DOL_URL_ROOT . '/compta/facture/note.php?id=' . $objp->facid . '">' . img_picto($langs->trans("ViewPrivateNote"), 'object_generic') . '</a>'; print '</span>'; } $filename = dol_sanitizeFileName($objp->facnumber); $filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber); $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $objp->facid; print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print '</td>'; print '</tr>'; print '</table>';
$num_lignes = $db->num_rows($result); $i = 0; if ($num_lignes) { $objp = $db->fetch_object($result); if ($objp->fk_code_ventilation == 0) { print '<form action="card.php?id=' . $_GET["id"] . '" method="post">' . "\n"; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="ventil">'; } print load_fiche_titre("Ventilation"); print '<table class="border" width="100%">'; // Ref facture print '<tr><td>' . $langs->trans("Invoice") . '</td>'; $facture_static->ref = $objp->facnumber; $facture_static->id = $objp->facid; print '<td>' . $facture_static->getNomUrl(1) . '</td>'; print '</tr>'; print '<tr><td width="20%">Ligne</td>'; print '<td>' . nl2br($objp->description) . '</td></tr>'; print '<tr><td width="20%">Ventiler dans le compte :</td><td>'; if ($objp->fk_code_ventilation == 0) { print $form->selectarray("codeventil", $cgs, $objp->fk_code_ventilation); } else { print $cgs[$objp->fk_code_ventilation]; } print '</td></tr>'; if ($objp->fk_code_ventilation == 0) { print '<tr><td> </td><td><input type="submit" class="button" value="' . $langs->trans("Ventiler") . '"></td></tr>'; } print '</table>'; print '</form>';
*/ if ($num > 0) { $var = True; $total = 0; $totalrecu = 0; while ($i < $num) { $objp = $db->fetch_object($resql); $var = !$var; print '<tr ' . $bc[$var] . '>'; print '<td nowrap="nowrap">'; $ticketstatic->id = $objp->ticketid; $ticketstatic->ref = $objp->facnumber; print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<td class="nobordernopadding" nowrap="nowrap">'; //print $ticketstatic->ref; print $ticketstatic->getNomUrl(1); print '</td>'; print '</tr></table>'; print "</td>\n"; // Date print '<td align="center" nowrap>'; print dol_print_date($db->jdate($objp->df), 'day'); print '</td>'; print '<td align="left">'; $cash = new Cash($db); $cash->fetch($objp->fk_cash); print $cash->getNomUrl(1); print '</td>'; print '<td align="left">'; if ($objp->fk_user_valid > 0) { $userstatic = new User($db);
$totalrecu = 0; $totalrecucreditnote = 0; $totalrecudeposits = 0; while ($i < $num) { $objp = $db->fetch_object($resql); $var = !$var; $invoice = new Facture($db); $invoice->fetch($objp->facid); $paiement = $invoice->getSommePaiement(); $creditnotes = $invoice->getSumCreditNotesUsed(); $deposits = $invoice->getSumDepositsUsed(); $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); print '<tr ' . $bc[$var] . '>'; print '<td>'; print $invoice->getNomUrl(1, ''); print "</td>\n"; // Date print '<td align="center">' . dol_print_date($db->jdate($objp->df), 'day') . "</td>\n"; // Prix print '<td align="right">' . price($objp->total_ttc) . '</td>'; // Recu print '<td align="right">' . price($paiement); if ($creditnotes) { print '+' . price($creditnotes); } if ($deposits) { print '+' . price($deposits); } print '</td>'; // Remain to pay
{ $var=True; while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($result); $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price, 5)):'' ; $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price, 5)):'' ; $var=!$var; print "<tr $bc[$var]>"; print '<td>'; $invoicestatic->id=$objp->facid; $invoicestatic->ref=$objp->facnumber; print $invoicestatic->getNomUrl(1); print "</td>\n"; print "<td align=\"center\">"; print dol_print_date($db->jdate($objp->datef),'day')."</td>"; print "<td align=\"right\">".price($objp->selling_price)."</td>\n"; print "<td align=\"right\">".price($objp->buying_price)."</td>\n"; print "<td align=\"right\">".price($objp->marge)."</td>\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "<td align=\"right\">".(($marginRate === '')?'n/a':price($marginRate)."%")."</td>\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) print "<td align=\"right\">".(($markRate === '')?'n/a':price($markRate)."%")."</td>\n"; print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>'; print "</tr>\n"; $i++; $cumul_achat += $objp->buying_price; $cumul_vente += $objp->selling_price;
} } else { $x_both = array(); //now, from these two arrays, get another array with one rate per line foreach (array_keys($x_coll) as $my_coll_rate) { $x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht']; $x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat']; $x_both[$my_coll_rate]['paye']['totalht'] = 0; $x_both[$my_coll_rate]['paye']['vat'] = 0; $x_both[$my_coll_rate]['coll']['links'] = ''; $x_both[$my_coll_rate]['coll']['detail'] = array(); foreach ($x_coll[$my_coll_rate]['facid'] as $id => $dummy) { $invoice_customer->id = $x_coll[$my_coll_rate]['facid'][$id]; $invoice_customer->ref = $x_coll[$my_coll_rate]['facnum'][$id]; $invoice_customer->type = $x_coll[$my_coll_rate]['type'][$id]; $x_both[$my_coll_rate]['coll']['detail'][] = array('id' => $x_coll[$my_coll_rate]['facid'][$id], 'descr' => $x_coll[$my_coll_rate]['descr'][$id], 'pid' => $x_coll[$my_coll_rate]['pid'][$id], 'pref' => $x_coll[$my_coll_rate]['pref'][$id], 'ptype' => $x_coll[$my_coll_rate]['ptype'][$id], 'payment_id' => $x_coll[$my_coll_rate]['payment_id'][$id], 'payment_amount' => $x_coll[$my_coll_rate]['payment_amount'][$id], 'ftotal_ttc' => $x_coll[$my_coll_rate]['ftotal_ttc'][$id], 'dtotal_ttc' => $x_coll[$my_coll_rate]['dtotal_ttc'][$id], 'dtype' => $x_coll[$my_coll_rate]['dtype'][$id], 'ddate_start' => $x_coll[$my_coll_rate]['ddate_start'][$id], 'ddate_end' => $x_coll[$my_coll_rate]['ddate_end'][$id], 'totalht' => $x_coll[$my_coll_rate]['totalht_list'][$id], 'vat' => $x_coll[$my_coll_rate]['vat_list'][$id], 'link' => $invoice_customer->getNomUrl(1, '', 12)); } } // tva paid foreach (array_keys($x_paye) as $my_paye_rate) { $x_both[$my_paye_rate]['paye']['totalht'] = $x_paye[$my_paye_rate]['totalht']; $x_both[$my_paye_rate]['paye']['vat'] = $x_paye[$my_paye_rate]['vat']; if (!isset($x_both[$my_paye_rate]['coll']['totalht'])) { $x_both[$my_paye_rate]['coll']['totalht'] = 0; $x_both[$my_paye_rate]['coll']['vat'] = 0; } $x_both[$my_paye_rate]['paye']['links'] = ''; $x_both[$my_paye_rate]['paye']['detail'] = array(); foreach ($x_paye[$my_paye_rate]['facid'] as $id => $dummy) { $invoice_supplier->id = $x_paye[$my_paye_rate]['facid'][$id]; $invoice_supplier->ref = $x_paye[$my_paye_rate]['facnum'][$id];
$companystatic = new Client($db); $totalclient = 0; $totalvat = 0; $totalltx1 = 0; $totalltx2 = 0; $totalp = 0; $totaltickets = 0; foreach ($tabfac as $key => $val) { $facturestatic->fetch($key); /*$facturestatic->id=$val["id"]; $facturestatic->ref=$val["ref"]; $facturestatic->type=$val["type"];*/ print "<tr " . $bc[$var] . ">"; // third party print "<td>" . dol_print_date($facturestatic->date_validation, "day") . "</td>"; print "<td>" . $facturestatic->getNomUrl(1) . "</td>"; foreach ($tabttc[$key] as $k => $mt) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['client']; print "<td>" . $k; print "</td><td>" . $langs->trans("ThirdParty"); print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')'; print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td><td align='right'>" . ($mt < 0 ? price(-$mt) : '') . "</td>"; $totalclient += $mt; } print "</tr>"; // product foreach ($tabht[$key] as $k => $mt) { if ($mt) { print "<tr " . $bc[$var] . ">";