本文整理汇总了PHP中FactureFournisseur::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP FactureFournisseur::fetch方法的具体用法?PHP FactureFournisseur::fetch怎么用?PHP FactureFournisseur::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactureFournisseur
的用法示例。
在下文中一共展示了FactureFournisseur::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FormCompany
$formcompany = new FormCompany($db);
$contactstatic=new Contact($db);
$userstatic=new User($db);
/* *************************************************************************** */
/* */
/* Mode vue et edition */
/* */
/* *************************************************************************** */
if (isset($mesg)) print $mesg;
$id = $_GET["facid"];
if ($id > 0)
{
$facture = new FactureFournisseur($db);
if ($facture->fetch($_GET['facid'], $user->societe_id) > 0)
{
$facture->fetch_thirdparty();
$head = facturefourn_prepare_head($facture);
dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), 0, 'bill');
/*
* Facture synthese pour rappel
*/
print '<table class="border" width="100%">';
// Reference du facture
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($facture,'facid','',1,'rowid','ref',$morehtmlref);
示例2: FactureFournisseur
$facusing = new FactureFournisseur($db);
$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 FactureFournisseur($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
print ')';
}
// FIXME $facidnext is not defined
/*
if ($facidnext > 0)
{
$facthatreplace=new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
*/
print '</td></tr>';
// Label
示例3: testFactureFournisseurDelete
/**
* testFactureFournisseurDelete
*
* @param int $id Id of supplier invoice
* @return void
*
* @depends testFactureFournisseurOther
* The depends says test is run only if previous is ok
*/
public function testFactureFournisseurDelete($id)
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
$localobject = new FactureFournisseur($this->savdb);
$result = $localobject->fetch($id);
$result = $localobject->delete($id);
print __METHOD__ . " id=" . $id . " result=" . $result . "\n";
$this->assertLessThan($result, 0);
return $result;
}
示例4: foreach
foreach ($links as $key => $val) {
if ($links[$key]['type'] == 'payment') {
$paymentstatic->fetch($links[$key]['url_id']);
$tmparray = $paymentstatic->getBillsArray('');
foreach ($tmparray as $key => $val) {
$invoicestatic->fetch($val);
if ($accountelem) {
$accountelem .= ', ';
}
$accountelem .= $invoicestatic->ref;
}
} elseif ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->fetch($links[$key]['url_id']);
$tmparray = $paymentsupplierstatic->getBillsArray('');
foreach ($tmparray as $key => $val) {
$invoicesupplierstatic->fetch($val);
if ($accountelem) {
$accountelem .= ', ';
}
$accountelem .= $invoicesupplierstatic->ref;
}
} elseif ($links[$key]['type'] == 'payment_sc') {
$paymentsocialcontributionstatic->fetch($links[$key]['url_id']);
if ($accountelem) {
$accountelem .= ', ';
}
$accountelem .= $langs->transnoentitiesnoconv("SocialContribution") . ' ' . $paymentsocialcontributionstatic->ref;
} elseif ($links[$key]['type'] == 'payment_vat') {
$paymentvatstatic->fetch($links[$key]['url_id']);
if ($accountelem) {
$accountelem .= ', ';
示例5: supplier_invoice_delete_preview
/**
* Delete preview files
* @param $db
* @param $objectid
* @return int
*/
function supplier_invoice_delete_preview($db, $objectid)
{
global $langs,$conf;
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$comfourn = new FactureFournisseur($db,"",$objectid);
$comfourn->fetch($objectid);
$client = new Societe($db);
$client->fetch($comfourn->socid);
if ($conf->fournisseur->dir_output.'/facture')
{
$comfournref = dol_sanitizeFileName($comfourn->ref);
$dir = $conf->facture->dir_output . "/" . $comfournref ;
$file = $dir . "/" . $comfournref . ".pdf.png";
if ( file_exists( $file ) && is_writable( $file ) )
{
if ( ! dol_delete_file($file) )
{
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
return 0;
}
}
}
return 1;
}
示例6: getSupplierInvoicesForThirdParty
/**
* Get list of invoices for third party
*
* @param array $authentication Array of authentication information
* @param int $idthirdparty Id thirdparty
* @return array Array result
*
*/
function getSupplierInvoicesForThirdParty($authentication,$idthirdparty)
{
global $db,$conf,$langs;
dol_syslog("Function: getSupplierInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
if ($authentication['entity']) $conf->entity=$authentication['entity'];
// Init and check authentication
$objectresp=array();
$errorcode='';$errorlabel='';
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
// Check parameters
if (! $error && empty($idthirdparty))
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel='Parameter id is not provided';
}
if (! $error)
{
$linesinvoice=array();
$sql.='SELECT f.rowid as facid';
$sql.=' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
//$sql.=', '.MAIN_DB_PREFIX.'societe as s';
//$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
$sql.=" WHERE f.entity = ".$conf->entity;
if ($idthirdparty != 'all') $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
$resql=$db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
while ($i < $num)
{
// En attendant remplissage par boucle
$obj=$db->fetch_object($resql);
$invoice=new FactureFournisseur($db);
$invoice->fetch($obj->facid);
// Define lines of invoice
$linesresp=array();
foreach($invoice->lines as $line)
{
$linesresp[]=array(
'id'=>$line->rowid,
'type'=>$line->product_type,
'desc'=>dol_htmlcleanlastbr($line->description),
'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc,
'vat_rate'=>$line->tva_tx,
'qty'=>$line->qty,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc,
);
}
// Now define invoice
$linesinvoice[]=array(
'id'=>$invoice->id,
'ref'=>$invoice->ref,
'ref_supplier'=>$invoice->ref_supplier,
'ref_ext'=>$invoice->ref_ext,
'fk_user_author' => $invoice->fk_user_author,
'fk_user_valid' => $invoice->fk_user_valid,
'fk_thirdparty' => $invoice->fk_soc,
'type'=>$invoice->type,
'status'=>$invoice->statut,
'total_net'=>$invoice->total_ht,
'total_vat'=>$invoice->total_tva,
'total'=>$invoice->total_ttc,
'date_creation'=>dol_print_date($invoice->datec,'dayhourrfc'),
'date_modification'=>dol_print_date($invoice->tms,'dayhourrfc'),
'date_invoice'=>dol_print_date($invoice->date,'dayhourrfc'),
'date_term'=>dol_print_date($invoice->date_echeance,'dayhourrfc'),
'label'=>$invoice->libelle,
'paid'=>$invoice->paye,
'note'=>$invoice->note,
'note_public'=>$invoice->note_public,
'close_code'=>$invoice->close_code,
'close_note'=>$invoice->close_note,
'lines' => $linesresp
);
//.........这里部分代码省略.........
示例7: create
/**
* Create payment in database
*
* @param User $user Object of creating user
* @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more
* @return int id of created payment, < 0 if error
*/
function create($user, $closepaidinvoices = 0)
{
global $langs, $conf;
$error = 0;
// Clean parameters
$this->total = 0;
foreach ($this->amounts as $key => $value) {
$newvalue = price2num($value, 'MT');
$this->amounts[$key] = $newvalue;
$this->total += $newvalue;
}
$this->total = price2num($this->total);
$this->db->begin();
if ($this->total != 0) {
$now = dol_now();
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'paiementfourn (';
$sql .= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
$sql .= " VALUES ('" . $this->db->idate($now) . "',";
$sql .= " '" . $this->db->idate($this->datepaye) . "', '" . $this->total . "', " . $this->paiementid . ", '" . $this->num_paiement . "', '" . $this->db->escape($this->note) . "', " . $user->id . ", 0)";
dol_syslog("PaiementFourn::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . 'paiementfourn');
// Insere tableau des montants / factures
foreach ($this->amounts as $key => $amount) {
$facid = $key;
if (is_numeric($amount) && $amount != 0) {
$amount = price2num($amount);
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'paiementfourn_facturefourn (fk_facturefourn, fk_paiementfourn, amount)';
$sql .= ' VALUES (' . $facid . ',' . $this->id . ',\'' . $amount . '\')';
$resql = $this->db->query($sql);
if ($resql) {
// If we want to closed payed invoices
if ($closepaidinvoices) {
$invoice = new FactureFournisseur($this->db);
$invoice->fetch($facid);
$paiement = $invoice->getSommePaiement();
//$creditnotes=$invoice->getSumCreditNotesUsed();
$creditnotes = 0;
//$deposits=$invoice->getSumDepositsUsed();
$deposits = 0;
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) {
$result = $invoice->set_paid($user, '', '');
} else {
dol_syslog("Remain to pay for invoice " . $facid . " not null. We do nothing.");
}
}
} else {
dol_syslog('Paiement::Create Erreur INSERT dans paiement_facture ' . $facid);
$error++;
}
} else {
dol_syslog('PaiementFourn::Create Montant non numerique', LOG_ERR);
}
}
if (!$error) {
// Call trigger
$result = $this->call_trigger('PAYMENT_SUPPLIER_CREATE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
} else {
$this->error = $this->db->lasterror();
$error++;
}
} else {
$this->error = "ErrorTotalIsNull";
dol_syslog('PaiementFourn::Create Error ' . $this->error, LOG_ERR);
$error++;
}
if ($this->total != 0 && $error == 0) {
$this->db->commit();
dol_syslog('PaiementFourn::Create Ok Total = ' . $this->total);
return $this->id;
} else {
$this->db->rollback();
return -1;
}
}
示例8: Societe
exit;
} else {
$db->rollback();
}
}
}
/*
* View
*/
$supplierstatic = new Societe($db);
$invoicesupplierstatic = new FactureFournisseur($db);
llxHeader();
$html = new Form($db);
if ($action == 'create' || $action == 'add_paiement') {
$facture = new FactureFournisseur($db);
$facture->fetch($facid);
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$dateinvoice = $datefacture == '' ? empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : 0 : $datefacture;
$sql = 'SELECT s.nom, s.rowid as socid,';
$sql .= ' f.rowid as ref, f.facnumber, f.amount, f.total_ttc as total';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user ";
}
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'societe as s, ' . MAIN_DB_PREFIX . 'facture_fourn as f';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= ' WHERE f.fk_soc = s.rowid';
$sql .= ' AND f.rowid = ' . $facid;
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
示例9: loadBox
/**
* 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 = " . $user->id;
}
if ($user->societe_id) {
$sql .= " 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"));
}
}
示例10: switch
function get_origin($fk_origin, $origintype)
{
switch ($origintype) {
case 'commande':
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
$origin = new Commande($this->db);
break;
case 'shipping':
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
$origin = new Expedition($this->db);
break;
case 'facture':
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
$origin = new Facture($this->db);
break;
case 'order_supplier':
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
$origin = new CommandeFournisseur($this->db);
break;
case 'invoice_supplier':
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
$origin = new FactureFournisseur($this->db);
break;
default:
return '';
break;
}
$origin->fetch($fk_origin);
return $origin->getNomUrl(1);
}
示例11: isset
$facid = isset($_GET["facid"])?$_GET["facid"]:'';
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture');
/*
* View
*/
llxHeader();
$fac = new FactureFournisseur($db);
$fac->fetch($_GET["facid"]);
$fac->info($_GET["facid"]);
$soc = new Societe($db, $fac->socid);
$soc->fetch($fac->socid);
$head = facturefourn_prepare_head($fac);
$titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), 0, 'bill');
print '<table width="100%"><tr><td>';
dol_print_object_info($fac);
print '</td></tr></table>';
print '</div>';
$db->close();
示例12: GETPOST
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$paiement_id = 0;
$totalpayment = 0;
$atleastonepaymentnotnull = 0;
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
$tmpinvoice = new FactureFournisseur($db);
foreach ($_POST as $key => $value) {
if (substr($key, 0, 7) == 'amount_') {
$cursorfacid = substr($key, 7);
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
$totalpayment = $totalpayment + $amounts[$cursorfacid];
if (!empty($amounts[$cursorfacid])) {
$atleastonepaymentnotnull++;
}
$result = $tmpinvoice->fetch($cursorfacid);
if ($result <= 0) {
dol_print_error($db);
}
$amountsresttopay[$cursorfacid] = price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
if ($amounts[$cursorfacid]) {
// Check amount
if ($amounts[$cursorfacid] && abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])) {
$addwarning = 1;
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")) . ' ' . $langs->trans("HelpPaymentHigherThanReminderToPaySupplier");
}
// Check date
if ($datepaye && $datepaye < $tmpinvoice->date) {
$langs->load("errors");
//$error++;
setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye, 'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings');
示例13: addPaymentToBank
/**
* A record into bank for payment with links between this bank record and invoices of payment.
* All payment properties must have been set first like after a call to create().
* @param user Object of user making payment
* @param mode 'payment', 'payment_supplier'
* @param label Label to use in bank record
* @param accountid Id of bank account to do link with
* @param emetteur_nom Name of transmitter
* @param emetteur_banque Name of bank
* @return int <0 if KO, bank_line_id if OK
*/
function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque,$notrigger=0)
{
global $conf,$langs,$user;
$error=0;
$bank_line_id=0;
$this->fk_account=$accountid;
if ($conf->banque->enabled)
{
require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
dol_syslog("$user->id,$mode,$label,$this->fk_account,$emetteur_nom,$emetteur_banque");
$acc = new Account($this->db);
$acc->fetch($this->fk_account);
$totalamount=$this->amount;
if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility
if ($mode == 'payment') $totalamount=$totalamount;
if ($mode == 'payment_supplier') $totalamount=-$totalamount;
// Insert payment into llx_bank
$bank_line_id = $acc->addline($this->datepaye,
$this->paiementid, // Payment mode id or code ("CHQ or VIR for example")
$label,
$totalamount,
$this->num_paiement,
'',
$user,
$emetteur_nom,
$emetteur_banque);
// Mise a jour fk_bank dans llx_paiement
// On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0)
{
$result=$this->update_fk_bank($bank_line_id);
if ($result <= 0)
{
$error++;
dol_print_error($this->db);
}
// Add link 'payment', 'payment_supplier' in bank_url between payment and bank transaction
if ( ! $error)
{
$url='';
if ($mode == 'payment') $url=DOL_URL_ROOT.'/compta/paiement/fiche.php?id=';
if ($mode == 'payment_supplier') $url=DOL_URL_ROOT.'/fourn/paiement/fiche.php?id=';
if ($url)
{
$result=$acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
if ($result <= 0)
{
$error++;
dol_print_error($this->db);
}
}
}
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
if (! $error)
{
$linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of.
{
if ($mode == 'payment')
{
$fac = new Facture($this->db);
$fac->fetch($key);
$fac->fetch_thirdparty();
if (! in_array($fac->thirdparty->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
{
$result=$acc->add_url_line($bank_line_id, $fac->thirdparty->id,
DOL_URL_ROOT.'/comm/fiche.php?socid=', $fac->thirdparty->nom, 'company');
if ($result <= 0) dol_print_error($this->db);
$linkaddedforthirdparty[$fac->thirdparty->id]=$fac->thirdparty->id; // Mark as done for this thirdparty
}
}
if ($mode == 'payment_supplier')
{
$fac = new FactureFournisseur($this->db);
$fac->fetch($key);
$fac->fetch_thirdparty();
if (! in_array($fac->thirdparty->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
{
$result=$acc->add_url_line($bank_line_id, $fac->thirdparty->id,
DOL_URL_ROOT.'/fourn/fiche.php?socid=', $fac->thirdparty->nom, 'company');
//.........这里部分代码省略.........
示例14: Facture
/**
* Show list of documents in a directory
* @param upload_dir Directory that was scanned
* @param filearray Array of files loaded by dol_dir_list function before calling this function
* @param modulepart Value for modulepart used by download wrapper
* @param param Parameters on sort links
* @param forcedownload Force to open dialog box "Save As" when clicking on file
* @param relativepath Relative path of docs (autodefined if not provided)
* @param permtodelete Permission to delete
* @param useinecm Change output for use in ecm module
* @param textifempty Text to show if filearray is empty
* @param maxlength Maximum length of file name shown
* @return int <0 if KO, nb of files shown if OK
*/
function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0)
{
global $user, $conf, $langs;
global $bc;
global $sortfield, $sortorder;
// Affiche liste des documents existant
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
//else { $bc[true]=''; $bc[false]=''; };
$url=$_SERVER["PHP_SELF"];
print '<table width="100%" class="nobordernopadding">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Documents2"),$_SERVER["PHP_SELF"],"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Size"),$_SERVER["PHP_SELF"],"size","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"date","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('','','');
print '</tr>';
if ($modulepart == 'invoice')
{
include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
$object_static=new Facture($this->db);
}
if ($modulepart == 'invoice_supplier')
{
include_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
$object_static=new FactureFournisseur($this->db);
}
$var=true;
foreach($filearray as $key => $file)
{
if (!is_dir($file['name'])
&& $file['name'] != '.'
&& $file['name'] != '..'
&& $file['name'] != 'CVS'
&& ! preg_match('/\.meta$/i',$file['name']))
{
// Define relative path used to store the file
$relativefile=preg_replace('/'.preg_quote($upload_dir.'/','/').'/','',$file['fullname']);
//print 'eeee'.$relativefile;
//var_dump($file);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>';
$id='';$ref='';
if ($modulepart == 'invoice')
{
preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg);
$ref=$reg[1];
$object_static->fetch('',$ref);
//print $relativefile.'rr'.$id;
print $object_static->getNomUrl(1,'document');
}
if ($modulepart == 'invoice_supplier')
{
preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg);
$id=$reg[1];
$object_static->fetch($id);
//print $relativefile.'rr'.$id;
print $object_static->getNomUrl(1,'document');
}
print '</td>';
print '<td>';
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
if ($forcedownload) print '&attachment=1';
print '&file='.urlencode($relativefile).'">';
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
print dol_trunc($file['name'],$maxlength,'middle');
print '</a>';
print "</td>\n";
print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>';
print '<td align="right">';
if (! empty($useinecm)) print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
if ($forcedownload) print '&attachment=1';
print '&file='.urlencode($relativefile).'">';
print img_view().'</a> ';
//if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'§ion='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
//else print ' ';
print "</td></tr>\n";
}
}
if (sizeof($filearray) == 0)
//.........这里部分代码省略.........
示例15: Societe
exit;
} else {
$db->rollback();
}
}
}
/*
* View
*/
$supplierstatic = new Societe($db);
$invoicesupplierstatic = new FactureFournisseur($db);
llxHeader();
$form = new Form($db);
if ($action == 'create' || $action == 'add_paiement') {
$object = new FactureFournisseur($db);
$object->fetch($facid);
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateinvoice = $datefacture == '' ? empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : 0 : $datefacture;
$sql = 'SELECT s.nom, s.rowid as socid,';
$sql .= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user ";
}
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'societe as s, ' . MAIN_DB_PREFIX . 'facture_fourn as f';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= ' WHERE f.fk_soc = s.rowid';
$sql .= ' AND f.rowid = ' . $facid;
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;