$obj = $db->fetch_object($resql); print '<tr ' . $bc[$var] . '><td>'; $facstatic->ref = $obj->ref; $facstatic->id = $obj->rowid; print $facstatic->getNomUrl(1, ''); print '</td>'; $societestatic->id = $obj->socid; $societestatic->nom = $obj->nom; $societestatic->client = 0; print '<td>' . $societestatic->getNomUrl(1, 'supplier', 44) . '</td>'; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print '<td align="right">' . price($obj->total_ht) . '</td>'; } print '<td align="right">' . price($obj->total_ttc) . '</td>'; print '<td align="right">' . price($obj->am) . '</td>'; print '<td>' . $facstatic->LibStatut($obj->paye, $obj->fk_statut, 3) . '</td>'; print '</tr>'; $total += $obj->total_ht; $total_ttc += $obj->total_ttc; $totalam += $obj->am; $i++; $var = !$var; } print '<tr class="liste_total"><td colspan="2">' . $langs->trans("Total") . ' <font style="font-weight: normal">(' . $langs->trans("RemainderToPay") . ': ' . price($total_ttc - $totalam) . ')</font> </td>'; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print '<td align="right">' . price($total) . '</td>'; } print '<td align="right">' . price($total_ttc) . '</td>'; print '<td align="right">' . price($totalam) . '</td>'; print '<td> </td>'; print '</tr>';
if ($db->jdate($objp->datelimite) < ($now - $conf->facture->fournisseur->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); print "</td>\n"; print '<td>'; $companystatic->id=$objp->socid; $companystatic->nom=$objp->nom; print $companystatic->getNomUrl(1,'supplier',32); print '</td>'; print "<td align=\"right\">".price($objp->total_ht)."</td>"; print "<td align=\"right\">".price($objp->total_ttc)."</td>"; print "<td align=\"right\">".price($objp->am)."</td>"; // Affiche statut de la facture print '<td align="right" nowrap="nowrap">'; print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); print '</td>'; print "</tr>\n"; $total_ht+=$objp->total_ht; $total_ttc+=$objp->total_ttc; $total_paid+=$objp->am; $i++; } print '<tr class="liste_total">'; print "<td colspan=\"5\" align=\"left\">".$langs->trans("Total").": </td>"; print "<td align=\"right\"><b>".price($total_ht)."</b></td>"; print "<td align=\"right\"><b>".price($total_ttc)."</b></td>"; print "<td align=\"right\"><b>".price($total_paid)."</b></td>";
/** * 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 . "/fourn/class/fournisseur.facture.class.php"; $facturestatic = new FactureFournisseur($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastSupplierBills", $max)); if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.nom, s.rowid as socid,"; $sql .= " f.rowid as facid, f.facnumber, f.amount,"; $sql .= " f.paye, f.fk_statut,"; $sql .= ' f.datef as df,'; $sql .= ' f.datec as datec,'; $sql .= ' f.date_lim_reglement as datelimite, f.tms, f.type'; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; $sql .= ", " . MAIN_DB_PREFIX . "facture_fourn 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; 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.tms DESC"; $sql .= $db->plimit($max, 0); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $now = dol_now(); $i = 0; $l_due_date = $langs->trans('Late') . ' (' . strtolower($langs->trans('DateEcheance')) . ': %s)'; while ($i < $num) { $objp = $db->fetch_object($result); $datelimite = $db->jdate($objp->datelimite); $datec = $db->jdate($objp->datec); $late = ''; if ($objp->paye == 0 && $datelimite < $now - $conf->facture->fournisseur->warning_delay) { $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day'))); } $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/fourn/facture/fiche.php?facid=" . $objp->facid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->facnumber, 'text2' => $late, 'url' => DOL_URL_ROOT . "/fourn/facture/fiche.php?facid=" . $objp->facid); $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid); $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datec, 'day')); $fac = new FactureFournisseur($db); $fac->fetch($objp->facid); $alreadypaid = $fac->getSommePaiement(); $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type)); $i++; } if ($num == 0) { $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoModifiedSupplierBills")); } } else { dol_print_error($db); } } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->transnoentities("ReadPermissionNotAllowed")); } }
while ($i < $num) { $objp = $db->fetch_object($resql); $var = !$var; print '<tr ' . $bc[$var] . '>'; // Ref print '<td><a href="' . DOL_URL_ROOT . '/fourn/facture/fiche.php?facid=' . $objp->facid . '">' . img_object($langs->trans('ShowBill'), 'bill') . ' '; print $objp->ref; print "</a></td>\n"; // Ref supplier print '<td>' . $objp->ref_supplier . "</td>\n"; // Third party print '<td><a href="' . DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $objp->socid . '">' . img_object($langs->trans('ShowCompany'), 'company') . ' ' . $objp->nom . '</a></td>'; // Expected to pay print '<td align="right">' . price($objp->total_ttc) . '</td>'; // Status print '<td align="center">' . $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 2, 1) . '</td>'; // Payed print '<td align="right">' . price($objp->amount) . '</td>'; print "</tr>\n"; if ($objp->paye == 1) { $allow_delete = 0; } $total = $total + $objp->amount; $i++; } } $var = !$var; print "</table>\n"; $db->free($resql); } else { dol_print_error($db);
while ($i < $num && $conf->liste_limit) { $objp = $db->fetch_object($result); $var = !$var; print "<tr " . $bc[$var] . ">"; print '<td>'; $supplierinvoicestatic->id = $objp->facid; $supplierinvoicestatic->ref = $objp->facnumber; print $supplierinvoicestatic->getNomUrl(1); print "</td>\n"; print '<td><a href="' . DOL_URL_ROOT . '/fourn/card.php?socid=' . $objp->socid . '">' . img_object($langs->trans("ShowCompany"), "company") . ' ' . dol_trunc($objp->name, 44) . '</a></td>'; print "<td>" . $objp->code_client . "</td>\n"; print "<td align=\"center\">"; print dol_print_date($db->jdate($objp->datef)) . "</td>"; print "<td align=\"center\">" . $objp->qty . "</td>\n"; print "<td align=\"right\">" . price($objp->total_ht) . "</td>\n"; print '<td align="right">' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . '</td>'; print "</tr>\n"; $i++; } } } else { dol_print_error($db); } print "</table>"; print '<br>'; $db->free($result); } } else { dol_print_error(); } llxFooter();
/** * 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 . '/fourn/class/fournisseur.facture.class.php'; include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php'; $facturestatic = new FactureFournisseur($db); $thirdpartytmp = new Fournisseur($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLast" . ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified") . "SupplierBills", $max)); if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql .= " s.code_fournisseur,"; $sql .= " s.logo,"; $sql .= " f.rowid as facid, f.ref, f.ref_supplier,"; $sql .= " f.total_ht,"; $sql .= " f.total_tva,"; $sql .= " f.total_ttc,"; $sql .= " f.paye, f.fk_statut,"; $sql .= ' f.datef as df,'; $sql .= ' f.datec as datec,'; $sql .= ' f.date_lim_reglement as datelimite, f.tms, f.type'; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; $sql .= ", " . MAIN_DB_PREFIX . "facture_fourn 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; 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; } if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) { $sql .= " ORDER BY f.datef DESC, f.ref DESC "; } else { $sql .= " ORDER BY f.tms DESC, f.ref DESC "; } $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') . ' (' . $langs->trans('DateEcheance') . ': %s)'; while ($line < $num) { $objp = $db->fetch_object($result); $datelimite = $db->jdate($objp->datelimite); $date = $db->jdate($objp->df); $datem = $db->jdate($objp->tms); $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; $facturestatic->total_ht = $objp->total_ht; $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; $thirdpartytmp->fournisseur = 1; $thirdpartytmp->code_fournisseur = $objp->code_fournisseur; $thirdpartytmp->logo = $objp->logo; $late = ''; if ($objp->paye == 0 && $datelimite && $datelimite < $now - $conf->facture->fournisseur->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' => $objp->ref_supplier, 'tooltip' => $langs->trans('SupplierInvoice') . ': ' . ($objp->ref ? $objp->ref : $objp->facid) . '<br>' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier, 'url' => DOL_URL_ROOT . "/fourn/facture/card.php?facid=" . $objp->facid); $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $thirdpartytmp->getNomUrl(1, 'supplier'), '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($date, 'day')); $fac = new FactureFournisseur($db); $fac->fetch($objp->facid); $alreadypaid = $fac->getSommePaiement(); $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type)); $line++; } if ($num == 0) { $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoModifiedSupplierBills")); } $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->transnoentities("ReadPermissionNotAllowed")); } }
print '</td>'; print '<td>' . dol_trunc($obj->libelle, 36) . '</td>'; print '<td>'; $supplierstatic->id = $obj->socid; $supplierstatic->nom = $obj->nom; print $supplierstatic->getNomUrl(1, '', 12); //print '<a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.$obj->nom.'</a</td>'; print '<td align="right">' . price($obj->total_ht) . '</td>'; print '<td align="right">' . price($obj->total_ttc) . '</td>'; $total += $obj->total_ht; $total_ttc += $obj->total_ttc; // Affiche statut de la facture print '<td align="right" nowrap="nowrap">'; // TODO le montant deja paye objp->am n'est pas definie //print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$objp->am); print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5); print '</td>'; print "</tr>\n"; $i++; if ($i == min($num, $limit)) { // Print total print '<tr class="liste_total">'; print '<td class="liste_total" colspan="6" align="left">' . $langs->trans("Total") . '</td>'; print '<td class="liste_total" align="right">' . price($total) . '</td>'; print '<td class="liste_total" align="right">' . price($total_ttc) . '</td>'; print '<td class="liste_total" align="center"> </td>'; print "</tr>\n"; } } print "</table>\n"; print "</form>\n";