Пример #1
0
 /**
  *  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;
     $langs->load("boxes");
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
     $thirdpartystatic = new Societe($db);
     include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
     $thirdpartytmp = new Fournisseur($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max));
     if ($user->rights->societe->lire) {
         $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,";
         $sql .= " s.code_fournisseur,";
         $sql .= " s.logo";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE s.fournisseur = 1";
         $sql .= " AND s.entity IN (" . getEntity('societe', 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 s.tms DESC ";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $line = 0;
             while ($line < $num) {
                 $objp = $db->fetch_object($result);
                 $datec = $db->jdate($objp->datec);
                 $datem = $db->jdate($objp->tms);
                 $thirdpartytmp->id = $objp->socid;
                 $thirdpartytmp->name = $objp->name;
                 $thirdpartytmp->code_client = $objp->code_client;
                 $thirdpartytmp->logo = $objp->logo;
                 $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $thirdpartytmp->getNomUrl(1, '', 40), 'asis' => 1);
                 $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day"));
                 $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3));
                 $line++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedSuppliers"));
             }
             $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"));
     }
 }
Пример #2
0
 // Ref
 print '<td class="nobordernopadding nowrap">';
 print $objectstatic->getNomUrl(1);
 $filename = dol_sanitizeFileName($obj->ref);
 $filedir = $conf->fournisseur->dir_output . '/commande' . '/' . dol_sanitizeFileName($obj->ref);
 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
 print '</td>' . "\n";
 // Ref Supplier
 if (empty($conf->global->SUPPLIER_ORDER_HIDE_REF_SUPPLIER)) {
     print '<td>' . $obj->ref_supplier . '</td>' . "\n";
 }
 // Thirdparty
 print '<td>';
 $thirdpartytmp->id = $obj->socid;
 $thirdpartytmp->name = $obj->name;
 print $thirdpartytmp->getNomUrl(1, 'supplier');
 print '</td>' . "\n";
 // Project
 if (!empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) {
     $projectstatic->id = $obj->project_id;
     $projectstatic->ref = $obj->project_ref;
     print '<td>';
     if ($obj->project_id > 0) {
         print $projectstatic->getNomUrl(1);
     }
     print '</td>';
 }
 // Author
 $userstatic->id = $obj->fk_user_author;
 $userstatic->lastname = $obj->lastname;
 $userstatic->firstname = $obj->firstname;
Пример #3
0
     $object->fetch_product_fournisseur_price($rowid, 1);
     //Ignore the math expression when getting the price
     print load_fiche_titre($langs->trans("ChangeSupplierPrice"));
 } else {
     print load_fiche_titre($langs->trans("AddSupplierPrice"));
 }
 print '<form action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '" method="POST">';
 print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
 print '<input type="hidden" name="action" value="updateprice">';
 dol_fiche_head();
 print '<table class="border" width="100%">';
 print '<tr><td class="fieldrequired" width="25%">' . $langs->trans("Supplier") . '</td><td>';
 if ($rowid) {
     $supplier = new Fournisseur($db);
     $supplier->fetch($socid);
     print $supplier->getNomUrl(1);
     print '<input type="hidden" name="id_fourn" value="' . $socid . '">';
     print '<input type="hidden" name="ref_fourn" value="' . $object->fourn_ref . '">';
     print '<input type="hidden" name="ref_fourn_price_id" value="' . $rowid . '">';
     print '<input type="hidden" name="rowid" value="' . $rowid . '">';
     print '<input type="hidden" name="socid" value="' . $socid . '">';
 } else {
     $events = array();
     $events[] = array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php', 1), 'htmlname' => 'tva_tx', 'params' => array());
     print $form->select_company(GETPOST("id_fourn"), 'id_fourn', 'fournisseur=1', 1, 0, 0, $events);
     $parameters = array('filtre' => "fournisseur=1", 'html_name' => 'id_fourn', 'selected' => GETPOST("id_fourn"), 'showempty' => 1, 'prod_id' => $object->id);
     $reshook = $hookmanager->executeHooks('formCreateThirdpartyOptions', $parameters, $object, $action);
     if (empty($reshook)) {
         if (empty($form->result)) {
             print ' - <a href="' . DOL_URL_ROOT . '/societe/soc.php?action=create&type=f&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=' . $action) . '">' . $langs->trans("CreateDolibarrThirdPartySupplier") . '</a>';
         }
 /**
  *	Display supplier of product
  *
  *	@param	int		$withpicto	Add picto
  *	@param	string	$option		Target of link ('', 'customer', 'prospect', 'supplier')
  *	@return	string				String with supplier price
  *  TODO Remove this method. Use getNomUrl directly.
  */
 function getSocNomUrl($withpicto = 0, $option = 'supplier')
 {
     $cust = new Fournisseur($this->db);
     $cust->fetch($this->fourn_id);
     return $cust->getNomUrl($withpicto, $option);
 }
 /**
  *	Display supplier of product
  *
  *	@param	int		$withpicto	Add picto
  *	@return	string				String with supplier price
  */
 function getSocNomUrl($withpicto = 0)
 {
     $cust = new Fournisseur($this->db);
     $cust->fetch($this->fourn_id);
     return $cust->getNomUrl($withpicto);
 }
 /**
  *	Display supplier of product
  *
  *	@param	int		$withpicto		Add picto
  *	@param	string	$option			Target of link ('', 'customer', 'prospect', 'supplier')
  *	@param	int		$maxlen			Max length of name
  *  @param	integer	$notooltip		1=Disable tooltip
  *	@return	string					String with supplier price
  *  TODO Remove this method. Use getNomUrl directly.
  */
 function getSocNomUrl($withpicto = 0, $option = 'supplier', $maxlen = 0, $notooltip = 0)
 {
     $thirdparty = new Fournisseur($this->db);
     $thirdparty->fetch($this->fourn_id);
     return $thirdparty->getNomUrl($withpicto, $option, $maxlen, $notooltip);
 }
Пример #7
0
            //print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
            print "<td>" . $val["date"] . "</td>";
            print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
            print "<td>" . $k . "</td><td>" . $langs->trans("VAT") . " " . $key . "</td>";
            print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
            print '<td align="right">' . ($mt < 0 ? price(-$mt) : '') . "</td>";
            print "</tr>";
        }
    }
    print "<tr " . $bc[$var] . ">";
    // third party
    //print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
    print "<td>" . $val["date"] . "</td>";
    print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
    foreach ($tabttc[$key] as $k => $mt) {
        $companystatic->id = $tabcompany[$key]['id'];
        $companystatic->name = $tabcompany[$key]['name'];
        print "<td>" . $k;
        print "</td><td>" . $langs->trans("ThirdParty");
        print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
        print "</td>";
        print '<td align="right">' . ($mt < 0 ? -price(-$mt) : '') . "</td>";
        print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
    }
    print "</tr>";
    $var = !$var;
}
print "</table>";
// End of page
llxFooter();
$db->close();
 /**
  *  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"));
     }
 }
Пример #9
0
 $facturestatic->ref = $obj->ref;
 $facturestatic->ref_supplier = $obj->facnumber;
 print $facturestatic->getNomUrl(1);
 print "</td>\n";
 print '<td nowrap="nowrap">' . dol_trunc($obj->facnumber, 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");
 }
 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
Пример #10
0
        $societe = new Fournisseur($db);
        $societe->fetch($fac->socid);

        if ($_GET['action'] == 'edit')
        {
            print_fiche_titre($langs->trans('SupplierInvoice'));

            print '<form name="update" action="fiche.php?facid='.$fac->id.'" method="post">';
            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
            print '<input type="hidden" name="action" value="update">';

            print '<table class="border" width="100%">';

            print '<tr><td class="fieldrequired">'.$langs->trans('Company').'</td>';
            print '<td>'.$societe->getNomUrl(1).'</td>';
            print '<td width="50%" valign="top">'.$langs->trans('NotePublic').'</td>';
            print '</tr>';

            // Ref
            print '<tr><td valign="top">'.$langs->trans('Ref').'</td><td valign="top">';
            print $fac->ref.'</td>';
            $rownb=10;
            print '<td rowspan="'.$rownb.'" valign="top">';
            print '<textarea name="note" wrap="soft" cols="60" rows="'.$rownb.'">';
            print $fac->note;
            print '</textarea></td></tr>';

            // Ref supplier
            print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td valign="top">';
            print '<input name="facnumber" type="text" value="'.$fac->ref_supplier.'"></td>';
Пример #11
0
///print "<td>".$langs->trans("JournalNum")."</td>";
print "<td>" . $langs->trans("Date") . "</td>";
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
print "<td>" . $langs->trans("Account") . "</td>";
print "<td>" . $langs->trans("Type") . "</td><td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = false;
$invoicestatic = new FactureFournisseur($db);
$companystatic = new Fournisseur($db);
foreach ($tabfac as $key => $val) {
    $invoicestatic->id = $key;
    $invoicestatic->ref = $val["ref"];
    $invoicestatic->type = $val["type"];
    $companystatic->id = $tabcompany[$key]['id'];
    $companystatic->name = $tabcompany[$key]['name'];
    $lines = array(array('var' => $tabht[$key], 'label' => $langs->trans('Products')), array('var' => $tabtva[$key], 'label' => $langs->trans('VAT')), array('var' => $tablocaltax1[$key], 'label' => $langs->transcountry('LT1', $mysoc->country_code)), array('var' => $tablocaltax2[$key], 'label' => $langs->transcountry('LT2', $mysoc->country_code)), array('var' => $tabttc[$key], 'label' => $langs->trans('ThirdParty') . ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')', 'nomtcheck' => true, 'inv' => true));
    foreach ($lines as $line) {
        foreach ($line['var'] as $k => $mt) {
            if (isset($line['nomtcheck']) || $mt) {
                print "<tr " . $bc[$var] . " >";
                print "<td>" . dol_print_date($val["date"]) . "</td>";
                print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
                print "<td>" . $k . "</td><td>" . $line['label'] . "</td>";
                if (isset($line['inv'])) {
                    print '<td align="right">' . ($mt < 0 ? price(-$mt) : '') . "</td>";
                    print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
                } else {
                    print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
                    print '<td align="right">' . ($mt < 0 ? price(-$mt) : '') . "</td>";
                }
                print "</tr>";