本文整理汇总了PHP中AccountLine::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP AccountLine::fetch方法的具体用法?PHP AccountLine::fetch怎么用?PHP AccountLine::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccountLine
的用法示例。
在下文中一共展示了AccountLine::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Supprime un paiement ainsi que les lignes qu'il a genere dans comptes
* Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
* Si le paiement porte sur au moins une facture a "payee", on refuse
*
* @param int $notrigger No trigger
* @return int <0 si ko, >0 si ok
*/
function delete($notrigger = 0)
{
global $conf, $user, $langs;
$error = 0;
$bank_line_id = $this->bank_line;
$this->db->begin();
// Verifier si paiement porte pas sur une facture classee
// Si c'est le cas, on refuse la suppression
$billsarray = $this->getBillsArray('fk_statut > 1');
if (is_array($billsarray)) {
if (count($billsarray)) {
$this->error = "ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible";
$this->db->rollback();
return -1;
}
} else {
$this->db->rollback();
return -2;
}
$accline = new AccountLine($this->db);
// Delete bank urls. If payment is on a conciliated line, return error.
if ($bank_line_id) {
$result = $accline->fetch($bank_line_id);
if ($result == 0) {
$accline->rowid = $bank_line_id;
}
// If not found, we set artificially rowid to allow delete of llx_bank_url
$result = $accline->delete_urls($user);
if ($result < 0) {
$this->error = $accline->error;
$this->db->rollback();
return -3;
}
}
// Delete payment (into paiement_facture and paiement)
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'paiement_facture';
$sql .= ' WHERE fk_paiement = ' . $this->id;
dol_syslog($sql);
$result = $this->db->query($sql);
if ($result) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'paiement';
$sql .= ' WHERE rowid = ' . $this->id;
dol_syslog($sql);
$result = $this->db->query($sql);
if (!$result) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -3;
}
// Supprimer l'ecriture bancaire si paiement lie a ecriture
if ($bank_line_id) {
$result = $accline->delete($user);
if ($result < 0) {
$this->error = $accline->error;
$this->db->rollback();
return -4;
}
}
if (!$notrigger) {
// Appel des triggers
$result = $this->call_trigger('PAYMENT_DELETE', $user);
if ($result < 0) {
$this->db->rollback();
return -1;
}
// Fin appel triggers
}
$this->db->commit();
return 1;
} else {
$this->error = $this->db->error;
$this->db->rollback();
return -5;
}
}
示例2: Account
$sql .= " b.emetteur,b.banque";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " WHERE rowid=" . $rowid;
$sql .= " ORDER BY dateo ASC";
$result = $db->query($sql);
if ($result) {
$i = 0;
$total = 0;
if ($db->num_rows($result)) {
$objp = $db->fetch_object($result);
$total = $total + $objp->amount;
$acct = new Account($db);
$acct->fetch($objp->fk_account);
$account = $acct->id;
$bankline = new AccountLine($db);
$bankline->fetch($rowid, $ref);
$links = $acct->get_url($rowid);
$bankline->load_previous_next_ref('', 'rowid');
// Confirmations
if ($action == 'delete_categ') {
print $form->formconfirm($_SERVER['PHP_SELF'] . "?rowid=" . $rowid . "&cat1=" . GETPOST("fk_categ") . "&orig_account=" . $orig_account, $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1);
}
print '<form name="update" method="POST" action="' . $_SERVER['PHP_SELF'] . '?rowid=' . $rowid . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="orig_account" value="' . $orig_account . '">';
print '<input type="hidden" name="id" value="' . $acct->id . '">';
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/bank/search.php">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td width="20%">' . $langs->trans("Ref") . "</td>";
示例3: header
$error++;
$langs->load("errors");
$mesg = '<div class="error">' . $langs->trans("ErrorPleaseTypeBankTransactionReportName") . '</div>';
}
if (!$error) {
header('Location: ' . DOL_URL_ROOT . '/compta/bank/rappro.php?account=' . $id);
// To avoid to submit twice and allow back
exit;
}
}
/*
* Action suppression ecriture
*/
if ($action == 'del') {
$bankline = new AccountLine($db);
$bankline->fetch($_GET["rowid"]);
$result = $bankline->delete($user);
if ($result < 0) {
dol_print_error($db, $bankline->error);
}
}
// Load bank groups
$sql = "SELECT rowid, label FROM " . MAIN_DB_PREFIX . "bank_categ ORDER BY label";
$resql = $db->query($sql);
$options = "";
if ($resql) {
$var = True;
$num = $db->num_rows($resql);
if ($num > 0) {
$options .= '<option value="0"' . (GETPOST('cat') ? '' : ' selected="true"') . '> </option>';
}
示例4: price
print $vatpayment->ref;
print '</td></tr>';
// Label
print '<tr><td>' . $langs->trans("Label") . '</td><td>' . $vatpayment->label . '</td></tr>';
print "<tr>";
print '<td>' . $langs->trans("DatePayment") . '</td><td colspan="3">';
print dol_print_date($vatpayment->datep, 'day');
print '</td></tr>';
print '<tr><td>' . $langs->trans("DateValue") . '</td><td colspan="3">';
print dol_print_date($vatpayment->datev, 'day');
print '</td></tr>';
print '<tr><td>' . $langs->trans("Amount") . '</td><td colspan="3">' . price($vatpayment->amount) . '</td></tr>';
if (!empty($conf->banque->enabled)) {
if ($vatpayment->fk_account > 0) {
$bankline = new AccountLine($db);
$bankline->fetch($vatpayment->fk_bank);
print '<tr>';
print '<td>' . $langs->trans('BankTransactionLine') . '</td>';
print '<td colspan="3">';
print $bankline->getNomUrl(1, 0, 'showall');
print '</td>';
print '</tr>';
}
}
// Other attributes
$parameters = array('colspan' => ' colspan="3"');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $vatpayment, $action);
// Note that $action and $object may have been modified by hook
print '</table>';
print '</div>';
/*
示例5: delete
/**
* Supprime un paiement ainsi que les lignes qu'il a genere dans comptes
* Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
* Si le paiement porte sur au moins une facture a "payee", on refuse
*
* @param int $notrigger No trigger
* @return int <0 si ko, >0 si ok
*/
function delete($notrigger = 0)
{
global $conf, $user, $langs;
$bank_line_id = $this->bank_line;
$this->db->begin();
// Verifier si paiement porte pas sur une facture a l'etat payee
// Si c'est le cas, on refuse la suppression
$billsarray = $this->getBillsArray('paye=1');
if (is_array($billsarray)) {
if (count($billsarray)) {
$this->error = "ErrorCantDeletePaymentSharedWithPayedInvoice";
$this->db->rollback();
return -1;
}
} else {
$this->db->rollback();
return -2;
}
// Verifier si paiement ne porte pas sur ecriture bancaire rapprochee
// Si c'est le cas, on refuse le delete
if ($bank_line_id) {
$accline = new AccountLine($this->db, $bank_line_id);
$accline->fetch($bank_line_id);
if ($accline->rappro) {
$this->error = "ErrorCantDeletePaymentReconciliated";
$this->db->rollback();
return -3;
}
}
// Efface la ligne de paiement (dans paiement_facture et paiement)
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'paiementfourn_facturefourn';
$sql .= ' WHERE fk_paiementfourn = ' . $this->id;
$resql = $this->db->query($sql);
if ($resql) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'paiementfourn';
$sql .= ' WHERE rowid = ' . $this->id;
$result = $this->db->query($sql);
if (!$result) {
$this->error = $this->db->error();
$this->db->rollback();
return -3;
}
// Supprimer l'ecriture bancaire si paiement lie a ecriture
if ($bank_line_id) {
$accline = new AccountLine($this->db);
$result = $accline->fetch($bank_line_id);
if ($result > 0) {
$result = $accline->delete();
}
if ($result < 0) {
$this->error = $accline->error;
$this->db->rollback();
return -4;
}
}
if (!$notrigger) {
// Appel des triggers
$result = $this->call_trigger('PAYMENT_SUPPLIER_DELETE', $user);
if ($result < 0) {
$this->db->rollback();
return -1;
}
// Fin appel triggers
}
$this->db->commit();
return 1;
} else {
$this->error = $this->db->error;
$this->db->rollback();
return -5;
}
}
示例6: delete
/**
* Delete a subscription
*
* @param User $user User that delete
* @return int <0 if KO, 0 if not found, >0 if OK
*/
function delete($user)
{
// It subscription is linked to a bank transaction, we get it
if ($this->fk_bank) {
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
$accountline = new AccountLine($this->db);
$result = $accountline->fetch($this->fk_bank);
}
$this->db->begin();
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "cotisation WHERE rowid = " . $this->id;
dol_syslog(get_class($this) . "::delete sql=" . $sql);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->affected_rows($resql);
if ($num) {
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
$result = $member->update_end_date($user);
if ($accountline->rowid > 0) {
$result = $accountline->delete($user);
// Return false if refused because line is conciliated
if ($result > 0) {
$this->db->commit();
return 1;
} else {
$this->error = $accountline->error;
$this->db->rollback();
return -1;
}
} else {
$this->db->commit();
return 1;
}
} else {
$this->db->commit();
return 0;
}
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}
}
示例7: price
print '</td></tr>';
print '<tr><td>' . $langs->trans("DateEndPeriod") . '</td><td colspan="3">';
print dol_print_date($salpayment->dateep, 'day');
print '</td></tr>';
print "<tr>";
print '<td>' . $langs->trans("DatePayment") . '</td><td colspan="3">';
print dol_print_date($salpayment->datep, 'day');
print '</td></tr>';
print '<tr><td>' . $langs->trans("DateValue") . '</td><td colspan="3">';
print dol_print_date($salpayment->datev, 'day');
print '</td></tr>';
print '<tr><td>' . $langs->trans("Amount") . '</td><td colspan="3">' . price($salpayment->amount, 0, $outputlangs, 1, -1, -1, $conf->currency) . '</td></tr>';
if (!empty($conf->banque->enabled)) {
if ($salpayment->fk_account > 0) {
$bankline = new AccountLine($db);
$bankline->fetch($salpayment->fk_bank);
print '<tr>';
print '<td>' . $langs->trans('BankTransactionLine') . '</td>';
print '<td colspan="3">';
print $bankline->getNomUrl(1, 0, 'showall');
print '</td>';
print '</tr>';
}
}
// Other attributes
$parameters = array('colspan' => ' colspan="3"');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $salpayment, $action);
// Note that $action and $object may have been modified by hook
print '</table>';
print '</div>';
/*
示例8: delete
/**
* Delete a social contribution
*
* @param User $user Object user making delete
* @return int <0 if KO, >0 if OK
*/
function delete($user)
{
$error = 0;
$this->db->begin();
// Get bank transaction lines for this social contributions
include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
$account = new Account($this->db);
$lines_url = $account->get_url('', $this->id, 'sc');
// Delete bank urls
foreach ($lines_url as $line_url) {
if (!$error) {
$accountline = new AccountLine($this->db);
$accountline->fetch($line_url['fk_bank']);
$result = $accountline->delete_urls($user);
if ($result < 0) {
$error++;
}
}
}
// Delete payments
if (!$error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "paiementcharge where fk_charge='" . $this->id . "'";
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->error = $this->db->lasterror();
}
}
if (!$error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "chargesociales where rowid='" . $this->id . "'";
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->error = $this->db->lasterror();
}
}
if (!$error) {
$this->db->commit();
return 1;
} else {
$this->db->rollback();
return -1;
}
}
示例9: AccountLine
if ($result < 0) $mesg=$bankline->error;
}
else
{
$langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorPleaseTypeBankTransactionReportName").'</div>';
}
}
/*
* Action suppression ecriture
*/
if ($_GET["action"] == 'del')
{
$accline=new AccountLine($db);
$accline->fetch($_GET["rowid"]);
$result=$accline->delete();
if ($result < 0)
{
dol_print_error($db,$accline->error);
}
}
// Charge categories
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ ORDER BY label";
$resql = $db->query($sql);
$options="";
if ($resql) {
$var=True;
$num = $db->num_rows($resql);
示例10: price
print '</td></tr>';
// Date
print '<tr><td valign="top" width="120">' . $langs->trans('Date') . '</td><td colspan="3">' . dol_print_date($paiement->datep, 'day') . '</td></tr>';
// Mode
print '<tr><td valign="top">' . $langs->trans('Mode') . '</td><td colspan="3">' . $langs->trans("PaymentType" . $paiement->type_code) . '</td></tr>';
// Numero
print '<tr><td valign="top">' . $langs->trans('Numero') . '</td><td colspan="3">' . $paiement->num_paiement . '</td></tr>';
// Montant
print '<tr><td valign="top">' . $langs->trans('Amount') . '</td><td colspan="3">' . price($paiement->amount) . ' ' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
// Note
print '<tr><td valign="top">' . $langs->trans('Note') . '</td><td colspan="3">' . nl2br($paiement->note) . '</td></tr>';
// Bank account
if ($conf->banque->enabled) {
if ($paiement->bank_account) {
$bankline = new AccountLine($db);
$bankline->fetch($paiement->bank_line);
print '<tr>';
print '<td>' . $langs->trans('BankTransactionLine') . '</td>';
print '<td colspan="3">';
print $bankline->getNomUrl(1, 0, 'showall');
print '</td>';
print '</tr>';
}
}
print '</table>';
/*
* List of social contributions payed
*/
$disable_delete = 0;
$sql = 'SELECT f.rowid as scid, f.libelle, f.paye, f.amount as sc_amount, pf.amount, pc.libelle as sc_type';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'paiementcharge as pf,' . MAIN_DB_PREFIX . 'chargesociales as f, ' . MAIN_DB_PREFIX . 'c_chargesociales as pc';
示例11: GETPOST
}
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Required to knwo date format for dol_print_date
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
$action = GETPOST('action');
/*
* View
*/
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvnext') {
// Increase date
$al = new AccountLine($db);
$al->datev_next($_GET["rowid"]);
$al->fetch($_GET["rowid"]);
print '<span>' . dol_print_date($db->jdate($al->datev), "day") . '</span>';
exit;
}
if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvprev') {
// Decrease date
$al = new AccountLine($db);
$al->datev_previous($_GET["rowid"]);
$al->fetch($_GET["rowid"]);
print '<span>' . dol_print_date($db->jdate($al->datev), "day") . '</span>';
exit;
}
示例12: price
print '</tr>';
// Date end subscription
print '<tr>';
print '<td>' . $langs->trans("DateEndSubscription") . '</td><td class="valeur" colspan="3">' . dol_print_date($subscription->datef, 'day') . '</td>';
print '</tr>';
// Amount
print '<tr><td>' . $langs->trans("Amount") . '</td><td class="valeur" colspan="3">' . price($subscription->amount) . '</td></tr>';
// Amount
print '<tr><td>' . $langs->trans("Label") . '</td><td class="valeur" colspan="3">' . $subscription->note . '</td></tr>';
// Bank line
if (!empty($conf->banque->enabled)) {
if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) {
print '<tr><td>' . $langs->trans("BankTransactionLine") . '</td><td class="valeur" colspan="3">';
if ($subscription->fk_bank) {
$bankline = new AccountLine($db);
$result = $bankline->fetch($subscription->fk_bank);
print $bankline->getNomUrl(1, 0, 'showall');
} else {
print $langs->trans("NoneF");
}
print '</td></tr>';
}
}
print "</table>\n";
print '</form>';
dol_fiche_end();
/*
* Barre d'actions
*
*/
print '<div class="tabsAction">';
示例13: rejectCheck
/**
* Check return management
* Reopen linked invoices and create a new negative payment.
*
* @param int $bank_id Id of bank transaction line concerned
* @param date $rejection_date Date to use on the negative payment
* @return int Id of negative payment line created
*/
function rejectCheck($bank_id, $rejection_date)
{
global $db, $user;
$payment = new Paiement($db);
$payment->fetch(0, 0, $bank_id);
$bankline = new AccountLine($db);
$bankline->fetch($bank_id);
/* Conciliation is allowed because when check is returned, a new line is created onto bank transaction log.
if ($bankline->rappro)
{
$this->error='ActionRefusedLineAlreadyConciliated';
return -1;
}*/
$this->db->begin();
// Not conciliated, we can delete it
//$bankline->delete($user); // We delete
$bankaccount = $payment->fk_account;
// Get invoices list to reopen them
$sql = 'SELECT pf.fk_facture, pf.amount';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'paiement_facture as pf';
$sql .= ' WHERE pf.fk_paiement = ' . $payment->id;
$resql = $db->query($sql);
if ($resql) {
$rejectedPayment = new Paiement($db);
$rejectedPayment->amounts = array();
$rejectedPayment->datepaye = $rejection_date;
$rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement');
$rejectedPayment->num_paiement = $payment->numero;
while ($obj = $db->fetch_object($resql)) {
$invoice = new Facture($db);
$invoice->fetch($obj->fk_facture);
$invoice->set_unpaid($user);
$rejectedPayment->amounts[$obj->fk_facture] = price2num($obj->amount) * -1;
}
$result = $rejectedPayment->create($user);
if ($result > 0) {
// We created a negative payment, we also add the line as bank transaction
$result = $rejectedPayment->addPaymentToBank($user, 'payment', '(CheckRejected)', $bankaccount, '', '');
if ($result > 0) {
$result = $payment->reject();
if ($result > 0) {
$this->db->commit();
return $rejectedPayment->id;
} else {
$this->db->rollback();
return -1;
}
} else {
$this->error = $rejectedPayment->error;
$this->errors = $rejectedPayment->errors;
$this->db->rollback();
return -1;
}
} else {
$this->error = $rejectedPayment->error;
$this->errors = $rejectedPayment->errors;
$this->db->rollback();
return -1;
}
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}
}
示例14: setEventMessages
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors');
}
if (!$error) {
header('Location: ' . DOL_URL_ROOT . '/compta/bank/rappro.php?account=' . $id);
// To avoid to submit twice and allow back
exit;
}
}
/*
* Action suppression ecriture
*/
if ($action == 'del') {
$bankline = new AccountLine($db);
if ($bankline->fetch($_GET["rowid"]) > 0) {
$result = $bankline->delete($user);
if ($result < 0) {
dol_print_error($db, $bankline->error);
}
} else {
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
}
}
// Load bank groups
$sql = "SELECT rowid, label FROM " . MAIN_DB_PREFIX . "bank_categ ORDER BY label";
$resql = $db->query($sql);
$options = "";
if ($resql) {
$var = True;
$num = $db->num_rows($resql);
示例15: delete
/**
* Delete object in database
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error = 0;
dol_syslog(get_class($this) . "::delete");
$this->db->begin();
if ($this->bank_line > 0) {
$accline = new AccountLine($this->db);
$accline->fetch($this->bank_line);
$result = $accline->delete();
if ($result < 0) {
$this->errors[] = $accline->error;
$error++;
}
}
if (!$error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "paiementcharge";
$sql .= " WHERE rowid=" . $this->id;
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = "Error " . $this->db->lasterror();
}
}
if (!$error) {
if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
$this->error .= $this->error ? ', ' . $errmsg : $errmsg;
}
$this->db->rollback();
return -1 * $error;
} else {
$this->db->commit();
return 1;
}
}