FIX Maxi debug of journalization of bank journal.

This commit is contained in:
Laurent Destailleur 2017-07-15 03:41:07 +02:00
parent de66971d93
commit cb87b314be
17 changed files with 493 additions and 283 deletions

View File

@ -176,7 +176,7 @@ class BookKeeping extends CommonObject
if (empty($this->credit)) $this->credit = 0;
// Check parameters
if (empty($this->numero_compte) || $this->numero_compte == '-1')
if (empty($this->numero_compte) || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')
{
$langs->load("errors");
if (in_array($this->doc_type, array('bank', 'expense_report')))

View File

@ -52,16 +52,7 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/paymentvarious.class.php';
$langs->load("companies");
$langs->load("other");
$langs->load("compta");
$langs->load("banks");
$langs->load('bills');
$langs->load('donations');
$langs->load("accountancy");
$langs->load("trips");
$langs->load("salaries");
$langs->load("hrm");
$langs->loadLangs(array("companies","other","compta","banks",'bills','donations',"accountancy","trips","salaries","hrm"));
// Multi journal
$id_journal = GETPOST('id_journal', 'int');
@ -73,6 +64,7 @@ $date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear');
$in_bookkeeping = GETPOST('in_bookkeeping');
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
$now = dol_now();
$action = GETPOST('action','aZ09');
@ -118,10 +110,12 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.row
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
if ($date_start && $date_end)
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
if ($in_bookkeeping == 'yes')
if ($in_bookkeeping == 'already')
$sql .= " AND (b.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
if ($in_bookkeeping == 'notyet')
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
$sql .= " ORDER BY b.datev";
@ -150,12 +144,12 @@ if ($result) {
$num = $db->num_rows($result);
// Variables
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
$account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
$account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
$account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
$account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef"));
$account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : $langs->trans("CodeNotDef"));
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
$account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
$account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
$tabcompany = array();
$tabuser = array();
@ -198,7 +192,7 @@ if ($result) {
// Variable bookkeeping
$tabpay[$obj->rowid]["date"] = $obj->do;
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type;
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
$tabpay[$obj->rowid]["ref"] = $obj->label;
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
@ -208,14 +202,20 @@ if ($result) {
}
$links = $object->get_url($obj->rowid);
// get_url may return -1 which is not traversable
if (is_array($links)) {
// Now loop on each link of record in bank.
foreach ( $links as $key => $val ) {
/*var_dump($i);
var_dump($links);*/
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'payment_salary', 'payment_various'))) // So we excluded 'company' here
// get_url may return -1 which is not traversable
if (is_array($links) && count($links) > 0) {
// Now loop on each link of record in bank.
foreach ($links as $key => $val) {
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'payment_salary', 'payment_various')))
{
// So we excluded 'company' and 'user' here. We want only payment lines
// We save tabtype for a future use, to remember what kind of payment it is
$tabpay[$obj->rowid]['type'] = $links[$key]['type'];
$tabtype[$obj->rowid] = $links[$key]['type'];
}
@ -236,7 +236,8 @@ if ($result) {
} else if ($links[$key]['type'] == 'user') {
$userstatic->id = $links[$key]['url_id'];
$userstatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
} else if ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id'];
@ -297,7 +298,7 @@ if ($result) {
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvariousstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
$paymentvariousstatic->fetch($paymentvariousstatic->id);
$account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : $langs->trans("CodeNotDef"));
$account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
$tabtp[$obj->rowid][$account_various] += $obj->amount;
} else if ($links[$key]['type'] == 'banktransfert') {
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
@ -305,10 +306,13 @@ if ($result) {
}
}
}
else
{
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or old record with no links in bank_url.
}
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
// Check account number is ok
/*if ($action == 'writebookkeeping') // Make test now in such a case
{
@ -330,7 +334,7 @@ if ($result) {
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
$i ++;
$i++;
}
} else {
dol_print_error($db);
@ -354,7 +358,7 @@ if (! $error && $action == 'writebookkeeping') {
$db->begin();
// Bank
if (! $errorforline)
if (! $errorforline && is_array($tabbq[$key]))
{
// Line into bank account
foreach ( $tabbq[$key] as $k => $mt )
@ -419,19 +423,23 @@ if (! $error && $action == 'writebookkeeping') {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport
}
} else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabuser[$key]['name'];
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment
} else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->subledger_account = '';
$bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat payment
} else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->subledger_account = '';
$bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation
} else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabuser[$key]['name'];
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment
} else if ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = '';
$bookkeeping->doc_ref = $langs->trans("VariousPayment") . ' (' . $val["paymentvariousid"] . ')'; // Ref of various payment
} else if ($tabtype[$key] == 'unknown') {
// ???
$bookkeeping->subledger_account = '';
$bookkeeping->doc_ref = '';
}
$result = $bookkeeping->create($user);
@ -440,7 +448,7 @@ if (! $error && $action == 'writebookkeeping') {
{
$error++;
$errorforline++;
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
@ -454,7 +462,7 @@ if (! $error && $action == 'writebookkeeping') {
}
// Third party
if (! $errorforline)
if (! $errorforline && is_array($tabtp[$key]))
{
// Line into thirdparty account
foreach ( $tabtp[$key] as $k => $mt ) {
@ -475,22 +483,11 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now;
if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$sqlmid = 'SELECT ch.libelle, t.libelle as labelc';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "chargesociales ch ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paych ON paych.fk_charge=ch.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "c_chargesociales as t ON ch.fk_type=t.id";
$sqlmid .= " WHERE paych.fk_bank=" . $key;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->label_compte = $objmid->labelc;
$bookkeeping->doc_ref = $objmid->libelle ;
}
$bookkeeping->subledger_account = '';
$bookkeeping->numero_compte = $k;
} else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
$bookkeeping->label_operation = '';
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -500,12 +497,14 @@ if (! $error && $action == 'writebookkeeping') {
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = $objmid->facnumber;
}
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
$bookkeeping->label_operation = '';
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$sqlmid = 'SELECT facf.ref_supplier,facf.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
@ -515,16 +514,14 @@ if (! $error && $action == 'writebookkeeping') {
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
}
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
} else if ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->label_operation = $tabuser[$key]['name'];
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_operation = $tabuser[$key]['name'];
$sqlmid = 'SELECT e.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "payment_expensereport as payer ON payer.fk_expensereport=e.rowid";
@ -533,32 +530,69 @@ if (! $error && $action == 'writebookkeeping') {
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport
}
} else if ($tabtype[$key] == 'payment_vat') {
} else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->label_operation = $tabuser[$key]['name'];
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$bookkeeping->label_operation = '';
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$sqlmid = 'SELECT ch.libelle, t.libelle as labelc';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "chargesociales ch ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paych ON paych.fk_charge=ch.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "c_chargesociales as t ON ch.fk_type=t.id";
$sqlmid .= " WHERE paych.fk_bank=" . $key;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->label_compte = $objmid->labelc;
$bookkeeping->doc_ref = $objmid->libelle ;
}
} else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->label_operation = '';
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat
} else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->label_operation = '';
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation
} else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_operation = $tabuser[$key]['name'];
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment
} else if ($tabtype[$key] == 'payment_various') {
$bookkeeping->label_operation = '';
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = $langs->trans("VariousPayment") . ' (' . $val["paymentvariousid"] . ')'; // Rowid of various payment
} else if ($tabtype[$key] == 'banktransfert') {
$bookkeeping->label_operation = '';
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = '';
} else {
// Temporary account
$bookkeeping->doc_ref = $k;
$bookkeeping->label_operation = '';
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
$bookkeeping->label_compte = '';
$bookkeeping->doc_ref = $k;
}
$result = $bookkeeping->create($user);
@ -567,7 +601,7 @@ if (! $error && $action == 'writebookkeeping') {
{
$error++;
$errorforline++;
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
@ -586,11 +620,13 @@ if (! $error && $action == 'writebookkeeping') {
}
else
{
//print 'KO for line '.$key.' '.$error.'<br>';
$db->rollback();
if ($error >= 10)
$MAXNBERRORS=5;
if ($error >= $MAXNBERRORS)
{
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
break; // Break in the foreach
}
}
@ -612,7 +648,7 @@ if (! $error && $action == 'writebookkeeping') {
}
// Export
if ($action == 'exportcsv') {
if ($action == 'exportcsv') { // ISO and not UTF8 !
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
@ -673,7 +709,6 @@ if ($action == 'exportcsv') {
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($tabtype[$key] == 'payment_supplier') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
} else if($tabtype[$key] == 'payment') {
@ -681,9 +716,6 @@ if ($action == 'exportcsv') {
} else {
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
}
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
@ -699,7 +731,7 @@ if ($action == 'exportcsv') {
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $journal . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print " " . $sep;
@ -738,7 +770,9 @@ if (empty($action) || $action == 'view') {
$builddate = time();
//$description = $langs->trans("DescFinanceJournal") . '<br>';
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal=' . $id_journal;
@ -750,6 +784,15 @@ if (empty($action) || $action == 'view') {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}*/
// Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}
print '<div class="tabsAction tabsActionNoBottom">';
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
@ -784,6 +827,7 @@ if (empty($action) || $action == 'view') {
print "<td>" . $langs->trans("Date") . "</td>";
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
print "<td>" . $langs->trans("Type") . "</td>";
print "<td>" . $langs->trans("PaymentMode") . "</td>";
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
@ -861,6 +905,20 @@ if (empty($action) || $action == 'view') {
}
else dol_print_error($db);
}
elseif ($tabtype[$key] == 'payment_salary')
{
$sqlmid = 'SELECT s.rowid as id';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$salarystatic->fetch($objmid->id);
$ref=$langs->trans("SalaryPayment").' '.$salarystatic->getNomUrl(1);
}
else dol_print_error($db);
}
elseif ($tabtype[$key] == 'payment_vat')
{
$sqlmid = 'SELECT v.rowid as id';
@ -889,20 +947,6 @@ if (empty($action) || $action == 'view') {
}
else dol_print_error($db);
}
elseif ($tabtype[$key] == 'payment_salary')
{
$sqlmid = 'SELECT s.rowid as id';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$salarystatic->fetch($objmid->id);
$ref=$langs->trans("SalaryPayment").' '.$salarystatic->getNomUrl(1);
}
else dol_print_error($db);
}
elseif ($tabtype[$key] == 'payment_various')
{
$sqlmid = 'SELECT v.rowid as id';
@ -928,18 +972,28 @@ if (empty($action) || $action == 'view') {
print "<td><!-- Bank bank.rowid=".$key."--></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
$accountoshow = length_accountg($k);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
else print $accountoshow;
else print $accounttoshow;
print "</td>";
// Subledger account
print "<td>";
/*$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
else print $accounttoshow;*/
print "</td>";
if ($val['soclib'] == '') {
print "<td>" . $bankstatic->label . " - " . $reflabel . "</td>";
print "<td>" . $langs->trans("Bank") . " - " . $reflabel . "</td>";
} else {
print "<td>" . $bankstatic->label . " - " . $val['soclib'] . "</td>";
print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>";
}
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
@ -955,13 +1009,36 @@ if (empty($action) || $action == 'view') {
print "<td><!-- Thirdparty bank.rowid=".$key." --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
$accountoshow = length_accounta($k);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
$account_ledger = $k;
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$accounttoshow = length_accounta($account_ledger);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
$errorstring='ThirdpartyDefaultAccountNotDefined';
if ($tabtype[$key] == 'payment') $errorstring='MainAccountForCustomersNotDefined';
if ($tabtype[$key] == 'payment_supplier') $errorstring='MainAccountForSuppliersNotDefined';
if ($tabtype[$key] == 'payment_expensereport') $errorstring='MainAccountForUsersNotDefined';
if ($tabtype[$key] == 'payment_salary') $errorstring='MainAccountForUsersNotDefined';
print '<span class="error">'.$langs->trans($errorstring).'</span>';
}
else print $accounttoshow;
print "</td>";
// Subledger account
print "<td>";
$accounttoshowsubledger = length_accounta($k);
if ($accounttoshow != $accounttoshowsubledger)
{
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
{
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
}
else print $accounttoshowsubledger;
}
else print $accountoshow;
print "</td>";
print "<td>" . $reflabel . ' ' . $val['soclib'] . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
@ -976,15 +1053,25 @@ if (empty($action) || $action == 'view') {
print "<td><!-- Wait bank.rowid=".$key." --></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
if (empty($accountoshow) || $accountoshow == 'NotDefined')
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
}
else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
print "</td>";
// Subledger account
print "<td>";
/*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
}
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
*/
print "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>&nbsp;</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";

View File

@ -53,6 +53,7 @@ $date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear');
$in_bookkeeping = GETPOST('in_bookkeeping');
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
$now = dol_now();
@ -105,7 +106,9 @@ $sql .= " AND erd.fk_code_ventilation > 0";
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
if ($date_start && $date_end)
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
if ($in_bookkeeping == 'yes')
if ($in_bookkeeping == 'already')
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
if ($in_bookkeeping == 'notyet')
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
$sql .= " ORDER BY er.date_debut";
@ -115,8 +118,8 @@ if ($result) {
$num = $db->num_rows($result);
// Variables
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef");
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined';
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
$taber = array ();
$tabht = array ();
@ -469,7 +472,8 @@ if (empty($action) || $action == 'view') {
$builddate = time();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal=' . $id_journal;

View File

@ -52,6 +52,7 @@ $date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear');
$in_bookkeeping = GETPOST('in_bookkeeping');
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
$now = dol_now();
@ -109,7 +110,9 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
}
if ($date_start && $date_end)
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
if ($in_bookkeeping == 'yes')
if ($in_bookkeeping == 'already')
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
if ($in_bookkeeping == 'notyet')
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
$sql .= " ORDER BY f.datef";
@ -119,8 +122,8 @@ if ($result) {
$num = $db->num_rows($result);
// Variables
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
$tabfac = array ();
$tabht = array ();
@ -139,9 +142,9 @@ if ($result) {
$compta_prod = $obj->compte;
if (empty($compta_prod)) {
if ($obj->product_type == 0)
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
else
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
}
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
@ -489,7 +492,8 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DepositsAreIncluded");
}
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal=' . $id_journal;

View File

@ -56,6 +56,7 @@ $date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear');
$in_bookkeeping = GETPOST('in_bookkeeping');
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
$now = dol_now();
@ -115,7 +116,9 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end)
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
if ($in_bookkeeping == 'yes')
if ($in_bookkeeping == 'already')
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
if ($in_bookkeeping == 'notyet')
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
$sql .= " ORDER BY f.datef";
@ -132,8 +135,8 @@ if ($result) {
$num = $db->num_rows($result);
// Variables
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
$i = 0;
while ( $i < $num ) {
@ -145,9 +148,9 @@ if ($result) {
$compta_prod = $obj->compte;
if (empty($compta_prod)) {
if ($obj->product_type == 0)
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
else
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
}
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
@ -506,7 +509,9 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DepositsAreNotIncluded");
else
$description .= $langs->trans("DepositsAreIncluded");
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal=' . $id_journal;

View File

@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
@ -46,17 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
$langs->load("banks");
$langs->load("bills");
$langs->load("categories");
$langs->load("companies");
$langs->load("margins");
$langs->load("salaries");
$langs->load("loan");
$langs->load("donations");
$langs->load("trips");
$langs->load("members");
$langs->load("compta");
$langs->loadLangs(array("banks","bills","categories","companies","margins","salaries","loan","donations","trips","members","compta","accountancy"));
$id = GETPOST('id','int');
$ref = GETPOST('ref','alpha');
@ -84,6 +75,7 @@ $debit=GETPOST("debit",'alpha');
$credit=GETPOST("credit",'alpha');
$type=GETPOST("type",'alpha');
$account=GETPOST("account",'int');
$accountancy_code=GETPOST('accountancy_code', 'alpha');
$bid=GETPOST("bid","int");
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
@ -276,11 +268,11 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
$amount = - price2num($_POST["adddebit"]);
}
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
$operation=$_POST["operation"];
$num_chq=$_POST["num_chq"];
$label=$_POST["label"];
$cat1=$_POST["cat1"];
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
$operation = GETPOST("operation",'alpha');
$num_chq = GETPOST("num_chq",'alpha');
$label = GETPOST("label",'alpha');
$cat1 = GETPOST("cat1",'alpha');
if (! $dateop) {
$error++;
@ -290,15 +282,24 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors');
}
if (! $label) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Label")), null, 'errors');
}
if (! $amount) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
}
if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
$error++;
}
if (! $error)
{
$object->fetch($id);
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user);
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $accountancy_code);
if ($insertid > 0)
{
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
@ -331,6 +332,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->m
$form = new Form($db);
$formother = new FormOther($db);
$formaccounting = new FormAccounting($db);
$companystatic=new Societe($db);
$bankaccountstatic=new Account($db);
@ -408,19 +410,32 @@ if ($id > 0 || ! empty($ref))
dol_fiche_end();
/*
* Buttons actions
*/
if ($action != 'reconcile')
{
print '<div class="tabsAction">';
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
{
if ($user->rights->banque->modifier) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'">'.$langs->trans("AddBankRecord").'</a>';
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
{
if ($user->rights->banque->modifier) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$account).'">'.$langs->trans("AddBankRecord").'</a>';
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
else // If direct entries is not done using miscellaneous payments
{
if ($user->rights->banque->modifier) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord").'</a>';
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
}
else
@ -637,6 +652,59 @@ if ($resql)
// print '</td></tr></table>';
}
// Form to add a transaction with no invoice
if ($user->rights->banque->modifier && $action == 'addline')
{
print load_fiche_titre($langs->trans("AddBankRecordLong"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>';
print '<td>&nbsp;</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Numero").'</td>';
print '<td colspan="2">'.$langs->trans("Description").'</td>';
print '<td align=right>'.$langs->trans("Debit").'</td>';
print '<td align=right>'.$langs->trans("Credit").'</td>';
if (! empty($conf->accounting->enabled))
{
print '<td align="center">';
print $langs->trans("AccountAccounting");
print '</td>';
}
print '<td colspan="2" align="center">&nbsp;</td>';
print '</tr>';
print '<tr '.$bcnd[false].'>';
print '<td class="nowrap" colspan="2">';
$form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction');
print '</td>';
print '<td class="nowrap">';
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
print '</td><td>';
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
print '<td colspan="2">';
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
if ($options) {
print '<br>'.$langs->trans("Rubrique").': ';
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
}
print '</td>';
print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit").'"></td>';
print '<td align="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit").'"></td>';
if (! empty($conf->accounting->enabled))
{
print '<td align="center">';
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
print '</td>';
}
print '<td colspan="2" align="center">';
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print '</table>';
print '<br>';
}
/// ajax to adjust value date with plus and less picto
print '

View File

@ -39,7 +39,7 @@ class Account extends CommonObject
public $element = 'bank_account';
public $table_element = 'bank_account';
public $picto = 'account';
/**
* @var int Use id instead of rowid
* @deprecated
@ -394,9 +394,10 @@ class Account extends CommonObject
* @param User $user User that create
* @param string $emetteur Name of cheque writer
* @param string $banque Bank of cheque writer
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
* @return int Rowid of added entry, <0 if KO
*/
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='')
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='', $accountancycode='')
{
// Deprecatîon warning
if (is_numeric($oper)) {
@ -456,6 +457,7 @@ class Account extends CommonObject
$accline->fk_user_author = $user->id;
$accline->fk_account = $this->rowid;
$accline->fk_type = $oper;
$accline->numero_compte = $accountancycode;
if ($num_chq) {
$accline->num_chq = $num_chq;
@ -538,7 +540,7 @@ class Account extends CommonObject
$now=dol_now();
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_account (";
$sql.= "datec";
$sql.= ", ref";
@ -619,14 +621,14 @@ class Account extends CommonObject
$result=$this->insertExtraFields();
if ($result < 0) $error++;
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BANKACCOUNT_CREATE',$user);
if ($result < 0) $error++;
// End call triggers
}
}
}
else
{
@ -670,9 +672,9 @@ class Account extends CommonObject
global $langs,$conf, $hookmanager;
$error=0;
$this->db->begin();
// Clean parameters
$this->state_id = ($this->state_id?$this->state_id:$this->state_id);
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
@ -739,7 +741,7 @@ class Account extends CommonObject
if ($result < 0) $error++;
}
}
if (! $error && ! $notrigger)
{
// Call trigger
@ -754,7 +756,7 @@ class Account extends CommonObject
$this->error=$this->db->lasterror();
dol_print_error($this->db);
}
if (! $error)
{
$this->db->commit();
@ -906,7 +908,7 @@ class Account extends CommonObject
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_update = $this->db->jdate($obj->date_update);
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
@ -983,15 +985,15 @@ class Account extends CommonObject
global $conf;
$error=0;
$this->db->begin();
// Delete link between tag and bank account
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_account";
$sql.= " WHERE fk_account = ".$this->id;
$resql = $this->db->query($sql);
if (!$resql)
{
@ -999,15 +1001,15 @@ class Account extends CommonObject
$this->error = "Error ".$this->db->lasterror();
}
}
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
if ($result)
{
// Remove extrafields
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
@ -1020,13 +1022,13 @@ class Account extends CommonObject
}
}
}
else
else
{
$error++;
$this->error = "Error ".$this->db->lasterror();
}
}
}
if (! $error)
{
$this->db->commit();
@ -1433,7 +1435,7 @@ class Account extends CommonObject
* - DeskCode
*
* Some countries show less or more bank account properties to the user
*
*
* @param int $includeibanbic 1=Return also key for IBAN and BIC
* @return array
* @see useDetailedBBAN
@ -1554,7 +1556,7 @@ class AccountLine extends CommonObject
var $element='bank';
var $table_element='bank';
var $picto = 'generic';
var $id;
var $ref;
var $datec;
@ -1683,8 +1685,9 @@ class AccountLine extends CommonObject
$sql .= ", num_chq";
$sql .= ", fk_account";
$sql .= ", fk_type";
$sql .= ",emetteur,banque";
$sql .= ", emetteur,banque";
$sql .= ", rappro";
$sql .= ", numero_compte";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($this->datec)."'";
$sql .= ", '".$this->db->idate($this->dateo)."'";
@ -1698,6 +1701,7 @@ class AccountLine extends CommonObject
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
$sql .= ", ".(int) $this->rappro;
$sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''");
$sql .= ")";
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
@ -1842,7 +1846,7 @@ class AccountLine extends CommonObject
function update_conciliation(User $user, $cat)
{
global $conf;
$this->db->begin();
// Check statement field
@ -1854,7 +1858,7 @@ class AccountLine extends CommonObject
return -1;
}
}
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET";
$sql.= " rappro = 1";
$sql.= ", num_releve = '".$this->db->escape($this->num_releve)."'";
@ -2042,7 +2046,7 @@ class AccountLine extends CommonObject
return $result;
}
/**
* Return label of status (activity, closed)
*
@ -2053,7 +2057,7 @@ class AccountLine extends CommonObject
{
return $this->LibStatut($this->status,$mode);
}
/**
* Renvoi le libelle d'un statut donne
*
@ -2097,6 +2101,6 @@ class AccountLine extends CommonObject
if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
}*/
}
}

View File

@ -325,14 +325,14 @@ class PaymentVarious extends CommonObject
$sql.= " VALUES (";
$sql.= "'".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", '".$this->sens."'";
$sql.= ", '".$this->db->escape($this->sens)."'";
$sql.= ", ".$this->amount;
$sql.= ", '".$this->type_payment."'";
$sql.= ", '".$this->num_payment."'";
$sql.= ", '".$this->db->escape($this->type_payment)."'";
$sql.= ", '".$this->db->escape($this->num_payment)."'";
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", '".$this->accountancy_code."'";
$sql.= ", '".$user->id."'";
$sql.= ", '".$this->db->escape($this->accountancy_code)."'";
$sql.= ", ".$user->id;
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", NULL";
$sql.= ", ".$conf->entity;
@ -342,7 +342,6 @@ class PaymentVarious extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
if ($this->id > 0)

View File

@ -29,15 +29,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
$langs->load("compta");
$langs->load("banks");
$langs->load("bills");
$langs->load("users");
$langs->load("accountancy");
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
// Get parameters
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$id=GETPOST("id",'int');
$action=GETPOST('action','alpha');
$cancel=GETPOST('cancel','alpha');
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
$label=GETPOST("label","alpha");
$sens=GETPOST("sens","int");
@ -61,115 +60,139 @@ $hookmanager->initHooks(array('variouscard','globalcard'));
* Actions
*/
if (! empty($cancel))
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
header("Location: index.php");
exit;
}
if ($action == 'add' && empty($cancel))
{
$error=0;
$datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
$datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
if (empty($datev)) $datev=$datep;
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
$object->datev=$datev;
$object->datep=$datep;
$object->amount=price2num(GETPOST("amount"));
$object->label=GETPOST("label");
$object->note=GETPOST("note");
$object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0;
$object->num_payment=GETPOST("num_payment");
$object->fk_user_author=$user->id;
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
if (empty($datep) || empty($datev))
if ($cancel)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$error++;
}
if (empty($object->type_payment) || $object->type_payment < 0)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
$error++;
}
if (empty($object->amount))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$error++;
}
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
$error++;
}
if (! $error)
{
$db->begin();
$ret=$object->create($user);
if ($ret > 0)
if ($action != 'addlink')
{
$db->commit();
header("Location: index.php");
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/myobject_list.php',1);
header("Location: ".$urltogo);
exit;
}
else
{
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
$action="create";
}
if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref);
$action='';
}
$action='create';
}
if ($action == 'delete')
{
$result=$object->fetch($id);
if ($object->rappro == 0)
if ($action == 'add')
{
$db->begin();
$error=0;
$ret=$object->delete($user);
if ($ret > 0)
$datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
$datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
if (empty($datev)) $datev=$datep;
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
$object->datev=$datev;
$object->datep=$datep;
$object->amount=price2num(GETPOST("amount"));
$object->label=GETPOST("label");
$object->note=GETPOST("note");
$object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0;
$object->num_payment=GETPOST("num_payment");
$object->fk_user_author=$user->id;
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
$object->sens=GETPOST('sens');
if (empty($datep) || empty($datev))
{
if ($object->fk_bank)
{
$accountline=new AccountLine($db);
$result=$accountline->fetch($object->fk_bank);
if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
}
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$error++;
}
if (empty($object->type_payment) || $object->type_payment < 0)
{
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
$error++;
}
if (empty($object->amount))
{
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$error++;
}
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
{
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
$error++;
}
if (! empty($conf->accounting->enabled) && ! $object->accountancy_code)
{
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
$error++;
}
if ($result >= 0)
if (! $error)
{
$db->begin();
$ret=$object->create($user);
if ($ret > 0)
{
$db->commit();
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
header("Location: index.php");
exit;
}
else
{
$object->error=$accountline->error;
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
$action="create";
}
}
$action='create';
}
if ($action == 'delete')
{
$result=$object->fetch($id);
if ($object->rappro == 0)
{
$db->begin();
$ret=$object->delete($user);
if ($ret > 0)
{
if ($object->fk_bank)
{
$accountline=new AccountLine($db);
$result=$accountline->fetch($object->fk_bank);
if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
}
if ($result >= 0)
{
$db->commit();
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
exit;
}
else
{
$object->error=$accountline->error;
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
{
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
{
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
}
}
else
{
setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
}
}
@ -200,8 +223,9 @@ if ($id)
/* ************************************************************************** */
if ($action == 'create')
{
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="action" value="add">';
print load_fiche_titre($langs->trans("NewVariousPayment"),'', 'title_accountancy.png');
@ -269,7 +293,7 @@ if ($action == 'create')
// Accountancy account
if (! empty($conf->accounting->enabled))
{
print '<tr><td>'.$langs->trans("AccountAccounting").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
print '<td>';
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
print '</td></tr>';
@ -292,7 +316,7 @@ if ($action == 'create')
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,9 +17,9 @@
*/
/**
* \file htdocs/compta/bank/various_payment/index.php
* \ingroup bank
* \brief List of various payments
* \file htdocs/compta/bank/various_payment/index.php
* \ingroup bank
* \brief List of various payments
*/
require '../../../main.inc.php';
@ -34,6 +35,8 @@ $socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'banque', '', '', '');
$optioncss = GETPOST('optioncss','alpha');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$search_ref = GETPOST('search_ref','int');
$search_user = GETPOST('search_user','alpha');
@ -50,11 +53,10 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="v.datep";
if (! $sortorder) $sortorder="DESC";
$optioncss = GETPOST('optioncss','alpha');
$filtre=$_GET["filtre"];
$filtre=GETPOST("filtre",'alpha');
if (empty($_REQUEST['typeid']))
if (! GETPOST('typeid'))
{
$newfiltre=str_replace('filtre=','',$filtre);
$filterarray=explode('-',$newfiltre);
@ -66,7 +68,7 @@ if (empty($_REQUEST['typeid']))
}
else
{
$typeid=$_REQUEST['typeid'];
$typeid=GETPOST('typeid');
}
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
@ -240,9 +242,12 @@ if ($result)
$colspan=4;
if (! empty($conf->banque->enabled)) $colspan++;
print '<tr class="liste_total"><td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
print '<tr class="liste_total">';
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.price($total)."</td>";
print "<td></td></tr>";
print '<td></td>';
print '<td></td>';
print '</tr>';
print "</table>";
print '</div>';

View File

@ -122,6 +122,8 @@ ALTER TABLE llx_actioncomm ADD COLUMN extraparams varchar(255);
ALTER TABLE llx_bank_account ADD COLUMN extraparams varchar(255);
ALTER TABLE llx_bank ADD COLUMN numero_compte varchar(32) NULL;
-- VMYSQL4.1 ALTER TABLE llx_bank_account MODIFY COLUMN state_id integer DEFAULT NULL;
-- VPGSQL8.2 ALTER TABLE llx_bank_account MODIFY COLUMN state_id integer USING state_id::integer;

View File

@ -32,6 +32,7 @@ create table llx_bank
fk_type varchar(6), -- TIP,VIR,PRE,CB,CHQ,... (Code in llx_c_paiement)
num_releve varchar(50),
num_chq varchar(50),
numero_compte varchar(32) NULL, -- FEC:CompteNum | account number
rappro tinyint default 0,
note text,
fk_bordereau integer DEFAULT 0,

View File

@ -28,7 +28,13 @@ OverviewOfAmountOfLinesBound=Overview of amount of lines already bound to accoun
OtherInfo=Other information
DeleteCptCategory=Remove accounting account from group
ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group ?
JournalizationInLedgerStatus=Status of journalization
AlreadyInGeneralLedger=Already journalized in ledgers
NotYetInGeneralLedger=Not yet journalized in ledgers
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
MainAccountForSuppliersNotDefined=Main accounting account for suppliers not defined in setup
MainAccountForUsersNotDefined=Main accounting account for users not defined in setup
AccountancyArea=Accountancy area
AccountancyAreaDescIntro=Usage of the accountancy module is done in several step:
@ -154,7 +160,7 @@ DelBookKeeping=Delete record of the Ledger
FinanceJournal=Finance journal
ExpenseReportsJournal=Expense reports journal
DescFinanceJournal=Finance journal including all the types of payments by bank account
DescJournalOnlyBindedVisible=This is a view of record that are bound to products/services accountancy account and can be recorded into the Ledger.
DescJournalOnlyBindedVisible=This is a view of record that are bound to accountancy account and can be recorded into the Ledger.
VATAccountNotDefined=Account for VAT not defined
ThirdpartyAccountNotDefined=Account for third party not defined
ProductAccountNotDefined=Account for product not defined

View File

@ -151,7 +151,7 @@ CheckRejectedAndInvoicesReopened=Check returned and invoices reopened
BankAccountModelModule=Document templates for bank accounts
DocumentModelSepaMandate=Template of SEPA mandate. Usefull for european countries in EEC only.
DocumentModelBan=Template to print a page with BAN information.
NewVariousPayment=New miscellaneous payment
VariousPayment=Miscellaneous payment
NewVariousPayment=New miscellaneous payments
VariousPayment=Miscellaneous payments
VariousPayments=Miscellaneous payments
ShowVariousPayment=Show miscellaneous payment
ShowVariousPayment=Show miscellaneous payments

View File

@ -191,9 +191,9 @@ ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for collecting VAT - V
ACCOUNTING_VAT_BUY_ACCOUNT=Accounting account by default for recovered VAT - VAT on purchases (used if not defined on VAT dictionary setup)
ACCOUNTING_VAT_PAY_ACCOUNT=Accounting account by default for paying VAT
ACCOUNTING_ACCOUNT_CUSTOMER=Accounting account used for customer third parties
ACCOUNTING_ACCOUNT_CUSTOMER_Desc=Dedicated accounting account defined on third party card will be used for Subledger accouting, this one for General Ledger or as default value of Subledger accounting if dedicated customer accouting account on third party is not defined
ACCOUNTING_ACCOUNT_CUSTOMER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accouting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated customer accouting account on third party is not defined.
ACCOUNTING_ACCOUNT_SUPPLIER=Accounting account used for supplier third parties
ACCOUNTING_ACCOUNT_SUPPLIER_Desc=Dedicated accounting account defined on third party card will be used for Subledger accouting, this one for General Ledger or as default value of Subledger accounting if dedicated supplier accouting account on third party is not defined
ACCOUNTING_ACCOUNT_SUPPLIER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accouting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated supplier accouting account on third party is not defined.
CloneTax=Clone a social/fiscal tax
ConfirmCloneTax=Confirm the clone of a social/fiscal tax payment
CloneTaxForNextMonth=Clone it for next month

View File

@ -1,6 +1,6 @@
# Dolibarr language file - Source file is en_US - salaries
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=Dedicated accounting account defined on user card will be used for Subledger accouting, this one for General Ledger or as default value of Subledger accounting if dedicated user accouting account on user is not defined
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated accounting account defined on user card will be used for Subledger accouting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accouting account on user is not defined.
SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for personnel expenses
Salary=Salary
Salaries=Salaries

View File

@ -258,10 +258,11 @@ if ($action == 'create')
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("MyObject")));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head();
dol_fiche_head(array(), '');
print '<table class="border centpercent">'."\n";
foreach($object->fields as $key => $val)
@ -277,7 +278,7 @@ if ($action == 'create')
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"> &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print '<div class="center"><input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'"> &nbsp; <input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"></div>';
print '</form>';
}