|
@@ -31,37 +31,37 @@
|
|
|
* \brief Page with bank journal
|
|
|
*/
|
|
|
require '../../main.inc.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/compta/sociales/class/chargesociales.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/don/class/paymentdonation.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
|
|
-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';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/loan/class/loan.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/loan/class/paymentloan.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
|
|
+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';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
|
|
|
|
|
// Load translation files required by the page
|
|
|
-$langs->loadLangs(array("companies","other","compta","banks","bills","donations","loan","accountancy","trips","salaries","hrm","members"));
|
|
|
+$langs->loadLangs(array("companies", "other", "compta", "banks", "bills", "donations", "loan", "accountancy", "trips", "salaries", "hrm", "members"));
|
|
|
|
|
|
// Multi journal
|
|
|
$id_journal = GETPOST('id_journal', 'int');
|
|
@@ -95,13 +95,13 @@ $pastmonth = strftime("%m", dol_now()) - 1;
|
|
|
$pastmonthyear = $year_current;
|
|
|
if ($pastmonth == 0) {
|
|
|
$pastmonth = 12;
|
|
|
- $pastmonthyear --;
|
|
|
+ $pastmonthyear--;
|
|
|
}
|
|
|
|
|
|
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
|
|
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
|
|
|
|
|
-if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
|
|
+if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
|
|
{
|
|
|
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
|
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
|
@@ -112,26 +112,26 @@ $sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_jour
|
|
|
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
|
|
|
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, bu2.type as typeop_user,";
|
|
|
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
|
|
|
-$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
|
|
-$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
|
|
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
|
|
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
|
|
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
|
|
|
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
|
|
|
-$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 b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
|
|
+$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
|
|
+$sql .= " JOIN ".MAIN_DB_PREFIX."bank_account as ba on b.fk_account=ba.rowid";
|
|
|
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
|
|
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
|
|
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
|
|
|
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
|
|
|
+$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 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) . "'";
|
|
|
+ $sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
|
|
// Already in bookkeeping or not
|
|
|
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') )";
|
|
|
+ $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 .= " 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";
|
|
|
//print $sql;
|
|
@@ -149,7 +149,7 @@ $paymentsalstatic = new PaymentSalary($db);
|
|
|
$paymentexpensereportstatic = new PaymentExpenseReport($db);
|
|
|
$paymentvariousstatic = new PaymentVarious($db);
|
|
|
$paymentloanstatic = new PaymentLoan($db);
|
|
|
-$accountLinestatic=new AccountLine($db);
|
|
|
+$accountLinestatic = new AccountLine($db);
|
|
|
$paymentsubscriptionstatic = new Subscription($db);
|
|
|
|
|
|
$tmppayment = new Paiement($db);
|
|
@@ -171,20 +171,20 @@ if ($result) {
|
|
|
//print $sql;
|
|
|
|
|
|
// Variables
|
|
|
- $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
|
|
- $account_customer = (($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_pay_subscription = (! empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_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
|
|
|
+ $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
|
|
+ $account_customer = (($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_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_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();
|
|
|
- $tabpay = array ();
|
|
|
- $tabbq = array ();
|
|
|
- $tabtp = array ();
|
|
|
- $tabtype = array ();
|
|
|
+ $tabpay = array();
|
|
|
+ $tabbq = array();
|
|
|
+ $tabtp = array();
|
|
|
+ $tabtype = array();
|
|
|
$tabmoreinfo = array();
|
|
|
|
|
|
// Loop on each line into llx_bank table. For each line, we should get:
|
|
@@ -199,8 +199,8 @@ if ($result) {
|
|
|
$lineisapurchase = -1;
|
|
|
$lineisasale = -1;
|
|
|
// Old method to detect if it's a sale or purchase
|
|
|
- if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1;
|
|
|
- if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1;
|
|
|
+ if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase = 1;
|
|
|
+ if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale = 1;
|
|
|
// Try a more reliable method to detect if record is a supplier payment or a customer payment
|
|
|
if ($lineisapurchase < 0)
|
|
|
{
|
|
@@ -221,9 +221,9 @@ if ($result) {
|
|
|
if ($lineisapurchase > 0)
|
|
|
$compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier);
|
|
|
if ($lineisasale > 0)
|
|
|
- $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
|
|
+ $compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
|
|
|
|
|
- $tabcompany[$obj->rowid] = array (
|
|
|
+ $tabcompany[$obj->rowid] = array(
|
|
|
'id' => $obj->socid,
|
|
|
'name' => $obj->name,
|
|
|
'code_compta' => $compta_soc,
|
|
@@ -231,9 +231,9 @@ if ($result) {
|
|
|
);
|
|
|
|
|
|
// Set accountancy code for user
|
|
|
- $compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
|
|
|
+ $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
|
|
|
|
|
|
- $tabuser[$obj->rowid] = array (
|
|
|
+ $tabuser[$obj->rowid] = array(
|
|
|
'id' => $obj->userid,
|
|
|
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
|
|
'lastname' => $obj->lastname,
|
|
@@ -244,8 +244,8 @@ if ($result) {
|
|
|
|
|
|
// Variable bookkeeping ($obj->rowid is Bank Id)
|
|
|
$tabpay[$obj->rowid]["date"] = $obj->do;
|
|
|
- $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
|
|
- $tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
|
|
+ $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
|
|
+ $tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
|
|
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
|
|
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
|
|
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
|
@@ -254,14 +254,14 @@ if ($result) {
|
|
|
} else {
|
|
|
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
|
|
|
}
|
|
|
- $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
|
|
|
+ $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
|
|
|
|
|
|
//var_dump($i);
|
|
|
//var_dump($tabpay);
|
|
|
//var_dump($tabcompany);
|
|
|
|
|
|
// By default
|
|
|
- $tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
|
|
|
+ $tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
|
|
|
$tabtype[$obj->rowid] = 'unknown';
|
|
|
$tabmoreinfo[$obj->rowid] = array();
|
|
|
|
|
@@ -287,18 +287,18 @@ if ($result) {
|
|
|
}
|
|
|
|
|
|
if ($links[$key]['type'] == 'withdraw') {
|
|
|
- $tabmoreinfo[$obj->rowid]['withdraw']=1;
|
|
|
+ $tabmoreinfo[$obj->rowid]['withdraw'] = 1;
|
|
|
}
|
|
|
|
|
|
if ($links[$key]['type'] == 'payment') {
|
|
|
$paymentstatic->id = $links[$key]['url_id'];
|
|
|
$paymentstatic->ref = $links[$key]['url_id'];
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this
|
|
|
$tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id;
|
|
|
} elseif ($links[$key]['type'] == 'payment_supplier') {
|
|
|
$paymentsupplierstatic->id = $links[$key]['url_id'];
|
|
|
$paymentsupplierstatic->ref = $links[$key]['url_id'];
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsupplierstatic->getNomUrl(2);
|
|
|
$tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id;
|
|
|
} elseif ($links[$key]['type'] == 'company') {
|
|
|
$societestatic->id = $links[$key]['url_id'];
|
|
@@ -313,13 +313,13 @@ if ($result) {
|
|
|
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
|
|
|
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
|
|
|
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.
|
|
|
+ else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
|
|
if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
|
|
} elseif ($links[$key]['type'] == 'sc') {
|
|
|
$chargestatic->id = $links[$key]['url_id'];
|
|
|
$chargestatic->ref = $links[$key]['url_id'];
|
|
|
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2);
|
|
|
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
|
|
if ($reg[1] == 'socialcontribution')
|
|
|
$reg[1] = 'SocialContribution';
|
|
@@ -332,13 +332,13 @@ if ($result) {
|
|
|
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
|
|
|
|
|
|
$sqlmid = 'SELECT cchgsoc.accountancy_code';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
|
|
|
- $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
|
|
|
- $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
|
|
|
- $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
|
|
|
- $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc ";
|
|
|
+ $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
|
|
|
+ $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
|
|
|
+ $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
|
|
|
+ $sqlmid .= " WHERE bkurl.fk_bank=".$obj->rowid;
|
|
|
|
|
|
- dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
|
|
+ dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG);
|
|
|
$resultmid = $db->query($sqlmid);
|
|
|
if ($resultmid) {
|
|
|
$objmid = $db->fetch_object($resultmid);
|
|
@@ -348,14 +348,14 @@ if ($result) {
|
|
|
$paymentdonstatic->id = $links[$key]['url_id'];
|
|
|
$paymentdonstatic->ref = $links[$key]['url_id'];
|
|
|
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentdonstatic->getNomUrl(2);
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
|
|
|
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
|
|
|
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
|
|
|
} elseif ($links[$key]['type'] == 'member') {
|
|
|
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
|
|
|
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
|
|
|
$paymentsubscriptionstatic->label = $links[$key]['label'];
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsubscriptionstatic->getNomUrl(2);
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
|
|
|
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
|
|
|
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
|
|
|
$tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount;
|
|
@@ -363,14 +363,14 @@ if ($result) {
|
|
|
$paymentvatstatic->id = $links[$key]['url_id'];
|
|
|
$paymentvatstatic->ref = $links[$key]['url_id'];
|
|
|
$paymentvatstatic->label = $links[$key]['label'];
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
|
|
|
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
|
|
|
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
|
|
|
} elseif ($links[$key]['type'] == 'payment_salary') {
|
|
|
$paymentsalstatic->id = $links[$key]['url_id'];
|
|
|
$paymentsalstatic->ref = $links[$key]['url_id'];
|
|
|
$paymentsalstatic->label = $links[$key]['label'];
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2);
|
|
|
$tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id;
|
|
|
} elseif ($links[$key]['type'] == 'payment_expensereport') {
|
|
|
$paymentexpensereportstatic->id = $links[$key]['url_id'];
|
|
@@ -380,25 +380,25 @@ if ($result) {
|
|
|
$paymentvariousstatic->id = $links[$key]['url_id'];
|
|
|
$paymentvariousstatic->ref = $links[$key]['url_id'];
|
|
|
$paymentvariousstatic->label = $links[$key]['label'];
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvariousstatic->getNomUrl(2);
|
|
|
+ $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 : 'NotDefined'); // NotDefined is a reserved word
|
|
|
- $account_subledger = (! empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
|
|
+ $account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
|
|
+ $account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
|
|
$tabpay[$obj->rowid]["account_various"] = $account_various;
|
|
|
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
|
|
|
} elseif ($links[$key]['type'] == 'payment_loan') {
|
|
|
$paymentloanstatic->id = $links[$key]['url_id'];
|
|
|
$paymentloanstatic->ref = $links[$key]['url_id'];
|
|
|
$paymentloanstatic->fk_loan = $links[$key]['url_id'];
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentloanstatic->getNomUrl(2);
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
|
|
|
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
|
|
|
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
|
|
|
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
|
|
|
- $sqlmid.= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
|
|
|
- $sqlmid.= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid;
|
|
|
+ $sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
|
|
|
+ $sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid;
|
|
|
|
|
|
- dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
|
|
+ dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG);
|
|
|
$resultmid = $db->query($sqlmid);
|
|
|
if ($resultmid) {
|
|
|
$objmid = $db->fetch_object($resultmid);
|
|
@@ -408,7 +408,7 @@ if ($result) {
|
|
|
}
|
|
|
} elseif ($links[$key]['type'] == 'banktransfert') {
|
|
|
$accountLinestatic->fetch($links[$key]['url_id']);
|
|
|
- $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- ' .$accountLinestatic ->getNomUrl(1);
|
|
|
+ $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
|
|
|
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
|
|
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
|
|
|
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
|
|
@@ -420,14 +420,14 @@ if ($result) {
|
|
|
|
|
|
// If no links were found to know the amount on thirdparty, we try to guess it.
|
|
|
// This may happens on bank entries without the links lines to 'company'.
|
|
|
- if (empty($tabtp[$obj->rowid]) && ! empty($tabmoreinfo[$obj->rowid]['withdraw'])) // If we dont find 'company' link because it is an old 'withdraw' record
|
|
|
+ if (empty($tabtp[$obj->rowid]) && !empty($tabmoreinfo[$obj->rowid]['withdraw'])) // If we dont find 'company' link because it is an old 'withdraw' record
|
|
|
{
|
|
|
foreach ($links as $key => $val) {
|
|
|
if ($links[$key]['type'] == 'payment') {
|
|
|
// Get thirdparty
|
|
|
$tmppayment->fetch($links[$key]['url_id']);
|
|
|
$arrayofamounts = $tmppayment->getAmountsArray();
|
|
|
- foreach($arrayofamounts as $invoiceid => $amount)
|
|
|
+ foreach ($arrayofamounts as $invoiceid => $amount)
|
|
|
{
|
|
|
$tmpinvoice->fetch($invoiceid);
|
|
|
$tmpinvoice->fetch_thirdparty();
|
|
@@ -478,7 +478,7 @@ var_dump($tabtp);
|
|
|
var_dump($tabtype);*/
|
|
|
|
|
|
// Write bookkeeping
|
|
|
-if (! $error && $action == 'writebookkeeping') {
|
|
|
+if (!$error && $action == 'writebookkeeping') {
|
|
|
$now = dol_now();
|
|
|
|
|
|
$error = 0;
|
|
@@ -501,7 +501,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
var_dump($tabbq);exit;*/
|
|
|
|
|
|
// Bank
|
|
|
- if (! $errorforline && is_array($tabbq[$key]))
|
|
|
+ if (!$errorforline && is_array($tabbq[$key]))
|
|
|
{
|
|
|
// Line into bank account
|
|
|
foreach ($tabbq[$key] as $k => $mt)
|
|
@@ -509,9 +509,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
|
|
|
- $reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
|
|
|
- if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
|
|
|
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
|
|
+ $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
|
|
|
+ if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
|
|
|
|
|
|
$bookkeeping = new BookKeeping($db);
|
|
|
$bookkeeping->doc_date = $val["date"];
|
|
@@ -528,7 +528,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
$bookkeeping->montant = $mt;
|
|
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
|
|
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
|
|
|
- $bookkeeping->credit = ($mt < 0 ? - $mt : 0);
|
|
|
+ $bookkeeping->credit = ($mt < 0 ? -$mt : 0);
|
|
|
$bookkeeping->code_journal = $journal;
|
|
|
$bookkeeping->journal_label = $journal_label;
|
|
|
$bookkeeping->fk_user_author = $user->id;
|
|
@@ -562,7 +562,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
}
|
|
|
|
|
|
// Third party
|
|
|
- if (! $errorforline)
|
|
|
+ if (!$errorforline)
|
|
|
{
|
|
|
if (is_array($tabtp[$key]))
|
|
|
{
|
|
@@ -571,14 +571,14 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":"");
|
|
|
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
|
|
|
if ($tabtype[$key] == 'banktransfert')
|
|
|
{
|
|
|
- $reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
|
|
|
+ $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- $reflabel.= dol_string_nohtmltag($val['soclib']);
|
|
|
+ $reflabel .= dol_string_nohtmltag($val['soclib']);
|
|
|
}
|
|
|
|
|
|
$bookkeeping = new BookKeeping($db);
|
|
@@ -590,7 +590,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
$bookkeeping->label_operation = $reflabel;
|
|
|
$bookkeeping->montant = $mt;
|
|
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
|
|
- $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
|
|
+ $bookkeeping->debit = ($mt < 0 ? -$mt : 0);
|
|
|
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
|
|
$bookkeeping->code_journal = $journal;
|
|
|
$bookkeeping->journal_label = $journal_label;
|
|
@@ -598,15 +598,15 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
$bookkeeping->date_creation = $now;
|
|
|
|
|
|
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
|
|
- $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
|
|
|
- $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
|
|
|
+ $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
|
|
|
+ $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
|
|
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
|
|
|
|
|
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
|
|
$bookkeeping->label_compte = $accountingaccount->label;
|
|
|
} elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
|
|
- $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
|
|
|
- $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
|
|
|
+ $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
|
|
|
+ $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
|
|
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
|
|
|
|
|
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
|
@@ -715,8 +715,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
|
|
|
- $reflabel.= dol_string_nohtmltag('WaitingAccount');
|
|
|
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
|
|
+ $reflabel .= dol_string_nohtmltag('WaitingAccount');
|
|
|
|
|
|
$bookkeeping = new BookKeeping($db);
|
|
|
$bookkeeping->doc_date = $val["date"];
|
|
@@ -726,7 +726,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
|
|
$bookkeeping->montant = $mt;
|
|
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
|
|
- $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
|
|
+ $bookkeeping->debit = ($mt < 0 ? -$mt : 0);
|
|
|
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
|
|
$bookkeeping->code_journal = $journal;
|
|
|
$bookkeeping->journal_label = $journal_label;
|
|
@@ -767,7 +767,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
|
|
|
}
|
|
|
|
|
|
- if (! $errorforline)
|
|
|
+ if (!$errorforline)
|
|
|
{
|
|
|
$db->commit();
|
|
|
}
|
|
@@ -776,11 +776,11 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
//print 'KO for line '.$key.' '.$error.'<br>';
|
|
|
$db->rollback();
|
|
|
|
|
|
- $MAXNBERRORS=5;
|
|
|
+ $MAXNBERRORS = 5;
|
|
|
if ($error >= $MAXNBERRORS)
|
|
|
{
|
|
|
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
|
|
|
- break; // Break in the foreach
|
|
|
+ break; // Break in the foreach
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -802,15 +802,15 @@ if (! $error && $action == 'writebookkeeping') {
|
|
|
// Must reload data, so we make a redirect
|
|
|
if (count($tabpay) != $error)
|
|
|
{
|
|
|
- $param='id_journal='.$id_journal;
|
|
|
- $param.='&date_startday='.$date_startday;
|
|
|
- $param.='&date_startmonth='.$date_startmonth;
|
|
|
- $param.='&date_startyear='.$date_startyear;
|
|
|
- $param.='&date_endday='.$date_endday;
|
|
|
- $param.='&date_endmonth='.$date_endmonth;
|
|
|
- $param.='&date_endyear='.$date_endyear;
|
|
|
- $param.='&in_bookkeeping='.$in_bookkeeping;
|
|
|
- header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
|
|
+ $param = 'id_journal='.$id_journal;
|
|
|
+ $param .= '&date_startday='.$date_startday;
|
|
|
+ $param .= '&date_startmonth='.$date_startmonth;
|
|
|
+ $param .= '&date_startyear='.$date_startyear;
|
|
|
+ $param .= '&date_endday='.$date_endday;
|
|
|
+ $param .= '&date_endmonth='.$date_endmonth;
|
|
|
+ $param .= '&date_endyear='.$date_endyear;
|
|
|
+ $param .= '&in_bookkeeping='.$in_bookkeeping;
|
|
|
+ header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : ''));
|
|
|
exit;
|
|
|
}
|
|
|
}
|
|
@@ -823,20 +823,20 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|
|
|
|
|
$filename = 'journal';
|
|
|
$type_export = 'journal';
|
|
|
- include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
|
|
+ include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
|
|
|
|
|
// CSV header line
|
|
|
- print '"' . $langs->transnoentitiesnoconv("BankId").'"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("Date") . '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("PaymentMode") . '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("AccountAccounting") . '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("LedgerAccount") . '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("SubledgerAccount") . '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("Label"). '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("Debit") . '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("Credit") . '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("Journal") . '"' . $sep;
|
|
|
- print '"' . $langs->transnoentitiesnoconv("Note") . '"' . $sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("BankId").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("Date").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("PaymentMode").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep;
|
|
|
+ print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
|
|
|
print "\n";
|
|
|
|
|
|
foreach ($tabpay as $key => $val)
|
|
@@ -850,21 +850,21 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
|
|
|
- $reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
|
|
|
- if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
|
|
|
-
|
|
|
- print '"' . $key . '"' . $sep;
|
|
|
- print '"' . $date . '"' . $sep;
|
|
|
- print '"' . $val["type_payment"] . '"' . $sep;
|
|
|
- print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
|
|
- print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
|
|
- print " " . $sep;
|
|
|
- print '"' . $reflabel . '"' . $sep;
|
|
|
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
|
|
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
|
|
- print '"' . $journal . '"' . $sep;
|
|
|
- print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
|
|
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
|
|
+ $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
|
|
|
+ if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
|
|
|
+
|
|
|
+ print '"'.$key.'"'.$sep;
|
|
|
+ print '"'.$date.'"'.$sep;
|
|
|
+ print '"'.$val["type_payment"].'"'.$sep;
|
|
|
+ print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
|
|
+ print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
|
|
+ print " ".$sep;
|
|
|
+ print '"'.$reflabel.'"'.$sep;
|
|
|
+ print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
|
|
+ print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
|
|
+ print '"'.$journal.'"'.$sep;
|
|
|
+ print '"'.dol_string_nohtmltag($ref).'"'.$sep;
|
|
|
print "\n";
|
|
|
}
|
|
|
}
|
|
@@ -875,37 +875,37 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":"");
|
|
|
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
|
|
|
if ($tabtype[$key] == 'banktransfert')
|
|
|
{
|
|
|
- $reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
|
|
|
+ $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- $reflabel.= dol_string_nohtmltag($val['soclib']);
|
|
|
+ $reflabel .= dol_string_nohtmltag($val['soclib']);
|
|
|
}
|
|
|
|
|
|
- print '"' . $key . '"' . $sep;
|
|
|
- print '"' . $date . '"' . $sep;
|
|
|
- print '"' . $val["type_payment"] . '"' . $sep;
|
|
|
- print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
|
|
+ print '"'.$key.'"'.$sep;
|
|
|
+ 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;
|
|
|
- } elseif($tabtype[$key] == 'payment') {
|
|
|
- print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
|
|
- } elseif($tabtype[$key] == 'payment_expensereport') {
|
|
|
- print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
|
|
|
- } elseif($tabtype[$key] == 'payment_salary') {
|
|
|
- print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
|
|
|
+ print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
|
|
|
+ } elseif ($tabtype[$key] == 'payment') {
|
|
|
+ print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep;
|
|
|
+ } elseif ($tabtype[$key] == 'payment_expensereport') {
|
|
|
+ print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
|
|
|
+ } elseif ($tabtype[$key] == 'payment_salary') {
|
|
|
+ print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
|
|
|
} else {
|
|
|
- print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
|
|
+ print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
|
|
}
|
|
|
- print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
|
|
- print '"' . $reflabel . '"' . $sep;
|
|
|
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
|
|
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
|
|
- print '"' . $journal . '"' . $sep;
|
|
|
- print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
|
|
+ print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
|
|
+ print '"'.$reflabel.'"'.$sep;
|
|
|
+ print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
|
|
+ print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
|
|
+ print '"'.$journal.'"'.$sep;
|
|
|
+ print '"'.dol_string_nohtmltag($ref).'"'.$sep;
|
|
|
print "\n";
|
|
|
}
|
|
|
}
|
|
@@ -914,20 +914,20 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
|
|
|
- $reflabel.= dol_string_nohtmltag('WaitingAccount');
|
|
|
-
|
|
|
- print '"' . $key . '"' . $sep;
|
|
|
- print '"' . $date . '"' . $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;
|
|
|
- print '"' . $reflabel . '"' . $sep;
|
|
|
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
|
|
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
|
|
- print '"' . $journal . '"' . $sep;
|
|
|
- print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
|
|
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
|
|
+ $reflabel .= dol_string_nohtmltag('WaitingAccount');
|
|
|
+
|
|
|
+ print '"'.$key.'"'.$sep;
|
|
|
+ print '"'.$date.'"'.$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;
|
|
|
+ print '"'.$reflabel.'"'.$sep;
|
|
|
+ print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
|
|
+ print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
|
|
+ print '"'.$journal.'"'.$sep;
|
|
|
+ print '"'.dol_string_nohtmltag($ref).'"'.$sep;
|
|
|
print "\n";
|
|
|
}
|
|
|
}
|
|
@@ -954,16 +954,16 @@ if (empty($action) || $action == 'view') {
|
|
|
|
|
|
llxHeader('', $langs->trans("FinanceJournal"));
|
|
|
|
|
|
- $nom = $langs->trans("FinanceJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
|
|
- $builddate=dol_now();
|
|
|
+ $nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
|
|
+ $builddate = dol_now();
|
|
|
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
|
|
- $description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
|
|
+ $description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
|
|
|
|
|
- $listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
|
|
- $period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0);
|
|
|
- $period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
|
|
+ $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
|
|
+ $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
|
|
|
+ $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
|
|
|
|
|
- $varlink = 'id_journal=' . $id_journal;
|
|
|
+ $varlink = 'id_journal='.$id_journal;
|
|
|
|
|
|
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
|
|
|
|
@@ -994,15 +994,15 @@ if (empty($action) || $action == 'view') {
|
|
|
|
|
|
print '<div class="tabsAction tabsActionNoBottom">';
|
|
|
|
|
|
- if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
|
|
+ if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
|
|
|
|
|
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
|
|
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
|
|
- print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
|
|
+ print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
|
|
}
|
|
|
else {
|
|
|
- if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
|
|
- else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
|
|
+ if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
|
|
|
+ else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
|
|
|
}
|
|
|
|
|
|
print '</div>';
|
|
@@ -1033,14 +1033,14 @@ if (empty($action) || $action == 'view') {
|
|
|
print '<div class="div-table-responsive">';
|
|
|
print "<table class=\"noborder\" width=\"100%\">";
|
|
|
print "<tr class=\"liste_titre\">";
|
|
|
- print "<td>" . $langs->trans("Date") . "</td>";
|
|
|
- print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>";
|
|
|
- print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
|
|
- print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
|
|
- print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
|
|
- print '<td class="center">' . $langs->trans("PaymentMode") . "</td>";
|
|
|
- print '<td class="right">' . $langs->trans("Debit") . "</td>";
|
|
|
- print '<td class="right">' . $langs->trans("Credit") . "</td>";
|
|
|
+ print "<td>".$langs->trans("Date")."</td>";
|
|
|
+ print "<td>".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").")</td>";
|
|
|
+ print "<td>".$langs->trans("AccountAccounting")."</td>";
|
|
|
+ print "<td>".$langs->trans("SubledgerAccount")."</td>";
|
|
|
+ print "<td>".$langs->trans("LabelOperation")."</td>";
|
|
|
+ print '<td class="center">'.$langs->trans("PaymentMode")."</td>";
|
|
|
+ print '<td class="right">'.$langs->trans("Debit")."</td>";
|
|
|
+ print '<td class="right">'.$langs->trans("Credit")."</td>";
|
|
|
print "</tr>\n";
|
|
|
|
|
|
$r = '';
|
|
@@ -1057,15 +1057,15 @@ if (empty($action) || $action == 'view') {
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
|
|
|
- $reflabel.= $langs->trans("Bank").' '.$val['bank_account_ref'];
|
|
|
- if (! empty($val['soclib'])) $reflabel .= " - " . $val['soclib'];
|
|
|
+ if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
|
|
|
+ $reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref'];
|
|
|
+ if (!empty($val['soclib'])) $reflabel .= " - ".$val['soclib'];
|
|
|
|
|
|
//var_dump($tabpay[$key]);
|
|
|
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
|
|
print '<tr class="oddeven">';
|
|
|
- print "<td>" . $date . "</td>";
|
|
|
- print "<td>" . $ref . "</td>";
|
|
|
+ print "<td>".$date."</td>";
|
|
|
+ print "<td>".$ref."</td>";
|
|
|
// Ledger account
|
|
|
print "<td>";
|
|
|
$accounttoshow = length_accountg($k);
|
|
@@ -1087,9 +1087,9 @@ if (empty($action) || $action == 'view') {
|
|
|
print "<td>";
|
|
|
print $reflabel;
|
|
|
print "</td>";
|
|
|
- print '<td class="center">' . $val["type_payment"] . "</td>";
|
|
|
- print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
|
- print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
|
|
+ print '<td class="center">'.$val["type_payment"]."</td>";
|
|
|
+ print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
|
|
+ print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
|
|
print "</tr>";
|
|
|
}
|
|
|
}
|
|
@@ -1100,20 +1100,20 @@ if (empty($action) || $action == 'view') {
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= $val['lib'] . ($val['soclib']?" - ":"");
|
|
|
+ if (!empty($val['lib'])) $reflabel .= $val['lib'].($val['soclib'] ? " - " : "");
|
|
|
if ($tabtype[$key] == 'banktransfert')
|
|
|
{
|
|
|
- $reflabel.= $langs->trans('TransitionalAccount').' '.$account_transfer;
|
|
|
+ $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- $reflabel.= $val['soclib'];
|
|
|
+ $reflabel .= $val['soclib'];
|
|
|
}
|
|
|
|
|
|
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
|
|
print '<tr class="oddeven">';
|
|
|
- print "<td>" . $date . "</td>";
|
|
|
- print "<td>" . $ref . "</td>";
|
|
|
+ print "<td>".$date."</td>";
|
|
|
+ print "<td>".$ref."</td>";
|
|
|
// Ledger account
|
|
|
print "<td>";
|
|
|
$account_ledger = $k;
|
|
@@ -1137,19 +1137,19 @@ if (empty($action) || $action == 'view') {
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
|
|
|
+ print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
// We will refuse writing
|
|
|
- $errorstring='UnknownAccountForThirdpartyBlocking';
|
|
|
- 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';
|
|
|
- if ($tabtype[$key] == 'payment_vat') $errorstring='MainAccountForVatPaymentNotDefined';
|
|
|
- if ($tabtype[$key] == 'member') $errorstring='MainAccountForSubscriptionPaymentNotDefined';
|
|
|
+ $errorstring = 'UnknownAccountForThirdpartyBlocking';
|
|
|
+ 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';
|
|
|
+ if ($tabtype[$key] == 'payment_vat') $errorstring = 'MainAccountForVatPaymentNotDefined';
|
|
|
+ if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
|
|
|
print '<span class="error">'.$langs->trans($errorstring).'</span>';
|
|
|
}
|
|
|
}
|
|
@@ -1169,7 +1169,7 @@ if (empty($action) || $action == 'view') {
|
|
|
var_dump($tabtype[$key]);
|
|
|
var_dump($tabbq[$key]);*/
|
|
|
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
|
|
- if (! empty($tabcompany[$key]['code_compta']))
|
|
|
+ if (!empty($tabcompany[$key]['code_compta']))
|
|
|
{
|
|
|
if (in_array($tabtype[$key], array('payment_various'))) {
|
|
|
// For such case, if subledger is not defined, we won't use subledger accounts.
|
|
@@ -1187,10 +1187,10 @@ if (empty($action) || $action == 'view') {
|
|
|
}
|
|
|
}
|
|
|
print "</td>";
|
|
|
- print "<td>" . $reflabel . "</td>";
|
|
|
- print '<td class="center">' . $val["type_payment"] . "</td>";
|
|
|
- print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
|
|
- print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
|
+ print "<td>".$reflabel."</td>";
|
|
|
+ print '<td class="center">'.$val["type_payment"]."</td>";
|
|
|
+ print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
|
|
+ print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
|
|
print "</tr>";
|
|
|
}
|
|
|
}
|
|
@@ -1199,13 +1199,13 @@ if (empty($action) || $action == 'view') {
|
|
|
if ($mt)
|
|
|
{
|
|
|
$reflabel = '';
|
|
|
- if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
|
|
|
- $reflabel.= 'WaitingAccount';
|
|
|
+ if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
|
|
|
+ $reflabel .= 'WaitingAccount';
|
|
|
|
|
|
print '<!-- Wait bank.rowid='.$key.' -->';
|
|
|
print '<tr class="oddeven">';
|
|
|
- print "<td>" . $date . "</td>";
|
|
|
- print "<td>" . $ref . "</td>";
|
|
|
+ print "<td>".$date."</td>";
|
|
|
+ print "<td>".$ref."</td>";
|
|
|
// Ledger account
|
|
|
print "<td>";
|
|
|
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
|
@@ -1223,10 +1223,10 @@ if (empty($action) || $action == 'view') {
|
|
|
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
|
|
|
*/
|
|
|
print "</td>";
|
|
|
- print "<td>" . $reflabel . "</td>";
|
|
|
- print '<td class="center">' . $val["type_payment"] . "</td>";
|
|
|
- print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
|
|
- print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
|
+ print "<td>".$reflabel."</td>";
|
|
|
+ print '<td class="center">'.$val["type_payment"]."</td>";
|
|
|
+ print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
|
|
+ print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
|
|
print "</tr>";
|
|
|
}
|
|
|
}
|
|
@@ -1287,63 +1287,63 @@ function getSourceDocRef($val, $typerecord)
|
|
|
{
|
|
|
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
|
|
|
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
|
|
- $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
|
|
|
+ $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"];
|
|
|
$ref = $langs->transnoentitiesnoconv("Invoice");
|
|
|
}
|
|
|
elseif ($typerecord == 'payment_supplier')
|
|
|
{
|
|
|
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
|
|
- $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
|
|
+ $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"];
|
|
|
$ref = $langs->transnoentitiesnoconv("SupplierInvoice");
|
|
|
}
|
|
|
elseif ($typerecord == 'payment_expensereport')
|
|
|
{
|
|
|
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
|
|
|
- $sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e";
|
|
|
+ $sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
|
|
$ref = $langs->transnoentitiesnoconv("ExpenseReport");
|
|
|
}
|
|
|
elseif ($typerecord == 'payment_salary')
|
|
|
{
|
|
|
$sqlmid = 'SELECT s.rowid as ref';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
|
|
|
- $sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
|
|
+ $sqlmid .= " WHERE s.rowid=".$val["paymentsalid"];
|
|
|
$ref = $langs->transnoentitiesnoconv("SalaryPayment");
|
|
|
}
|
|
|
elseif ($typerecord == 'sc')
|
|
|
{
|
|
|
$sqlmid = 'SELECT sc.rowid as ref';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc";
|
|
|
- $sqlmid .= " WHERE sc.rowid=" . $val["paymentscid"];
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc";
|
|
|
+ $sqlmid .= " WHERE sc.rowid=".$val["paymentscid"];
|
|
|
$ref = $langs->transnoentitiesnoconv("SocialContribution");
|
|
|
}
|
|
|
elseif ($typerecord == 'payment_vat')
|
|
|
{
|
|
|
$sqlmid = 'SELECT v.rowid as ref';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
|
|
|
- $sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v";
|
|
|
+ $sqlmid .= " WHERE v.rowid=".$val["paymentvatid"];
|
|
|
$ref = $langs->transnoentitiesnoconv("PaymentVat");
|
|
|
}
|
|
|
elseif ($typerecord == 'payment_donation')
|
|
|
{
|
|
|
$sqlmid = 'SELECT payd.fk_donation as ref';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
|
|
|
- $sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd";
|
|
|
+ $sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"];
|
|
|
$ref = $langs->transnoentitiesnoconv("Donation");
|
|
|
}
|
|
|
elseif ($typerecord == 'payment_loan')
|
|
|
{
|
|
|
$sqlmid = 'SELECT l.rowid as ref';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_loan as l";
|
|
|
- $sqlmid .= " WHERE l.rowid=" . $val["paymentloanid"];
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l";
|
|
|
+ $sqlmid .= " WHERE l.rowid=".$val["paymentloanid"];
|
|
|
$ref = $langs->transnoentitiesnoconv("LoanPayment");
|
|
|
}
|
|
|
elseif ($typerecord == 'payment_various')
|
|
|
{
|
|
|
$sqlmid = 'SELECT v.rowid as ref';
|
|
|
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
|
|
|
- $sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
|
|
|
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
|
|
+ $sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"];
|
|
|
$ref = $langs->transnoentitiesnoconv("VariousPayment");
|
|
|
}
|
|
|
// Add warning
|
|
@@ -1354,18 +1354,18 @@ function getSourceDocRef($val, $typerecord)
|
|
|
|
|
|
if ($sqlmid)
|
|
|
{
|
|
|
- dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
|
|
+ dol_syslog("accountancy/journal/bankjournal.php::sqlmid=".$sqlmid, LOG_DEBUG);
|
|
|
$resultmid = $db->query($sqlmid);
|
|
|
if ($resultmid)
|
|
|
{
|
|
|
while ($objmid = $db->fetch_object($resultmid))
|
|
|
{
|
|
|
- $ref.=' '.$objmid->ref;
|
|
|
+ $ref .= ' '.$objmid->ref;
|
|
|
}
|
|
|
}
|
|
|
else dol_print_error($db);
|
|
|
}
|
|
|
|
|
|
- $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
|
|
|
+ $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
|
|
|
return $ref;
|
|
|
}
|