Skip to content
Snippets Groups Projects
Commit 8aed039a authored by aspangaro's avatar aspangaro
Browse files

FIX: Accountancy Bank journal Fix some problem with other module

parent 10f30cf5
No related branches found
No related tags found
No related merge requests found
...@@ -52,8 +52,9 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; ...@@ -52,8 +52,9 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
$langs->load("companies"); $langs->load("companies");
$langs->load("other"); $langs->load("other");
$langs->load("compta"); $langs->load("compta");
$langs->load("bank"); $langs->load("banks");
$langs->load('bills'); $langs->load('bills');
$langs->load('donations');
$langs->load("accountancy"); $langs->load("accountancy");
$id_bank_account = GETPOST('id_account', 'int'); $id_bank_account = GETPOST('id_account', 'int');
...@@ -130,11 +131,12 @@ if ($result) { ...@@ -130,11 +131,12 @@ if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
// Variables // Variables
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); $account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
$accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef")); $account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
$accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef")); $account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
$accountancy_account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $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"));
$tabpay = array (); $tabpay = array ();
$tabbq = array (); $tabbq = array ();
...@@ -154,11 +156,9 @@ if ($result) { ...@@ -154,11 +156,9 @@ if ($result) {
// Controls // Controls
$compta_bank = $obj->account_number; $compta_bank = $obj->account_number;
if ($obj->label == '(SupplierInvoicePayment)') if ($obj->label == '(SupplierInvoicePayment)')
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $cptfour); $compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
if ($obj->label == '(CustomerInvoicePayment)') if ($obj->label == '(CustomerInvoicePayment)')
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli); $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
if ($obj->typeop == '(BankTransfert)')
$compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH;
// Variable bookkeeping // Variable bookkeeping
$tabpay[$obj->rowid]["date"] = $obj->do; $tabpay[$obj->rowid]["date"] = $obj->do;
...@@ -226,25 +226,23 @@ if ($result) { ...@@ -226,25 +226,23 @@ if ($result) {
$paymentdonstatic->id = $links[$key]['url_id']; $paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id']; $paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation"); $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation");
$tabtp[$obj->rowid][$accountancy_account_pay_donation] += $obj->amount; $tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
} else if ($links[$key]['type'] == 'payment_vat') { } else if ($links[$key]['type'] == 'payment_vat') {
$paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id'];
$paymentvatstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat"); $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat");
$tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount; $tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
} else if ($links[$key]['type'] == 'payment_salary') { } else if ($links[$key]['type'] == 'payment_salary') {
$paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id'];
$paymentsalstatic->label = $links[$key]['label']; $paymentsalstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; $tabtp[$obj->rowid][$account_employee ] += $obj->amount;
} else if ($links[$key]['type'] == 'banktransfert') { } else if ($links[$key]['type'] == 'banktransfert') {
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
$tabtp[$obj->rowid][$cpttva] += $obj->amount; $tabtp[$obj->rowid][$account_transfer] += $obj->amount;
} }
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
} }
} }
...@@ -588,24 +586,30 @@ else { ...@@ -588,24 +586,30 @@ else {
foreach ( $tabpay as $key => $val ) { foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
if ($val["lib"] == '(SupplierInvoicePayment)') { $reflabel = $val["ref"];
$reflabel = $langs->trans('SupplierInvoicePayment'); if ($reflabel == '(SupplierInvoicePayment)') {
$reflabel = $langs->trans('Supplier');
}
if ($reflabel == '(CustomerInvoicePayment)') {
$reflabel = $langs->trans('Customer');
} }
if ($val["lib"] == '(CustomerInvoicePayment)') { if ($reflabel == '(SocialContributionPayment)') {
$reflabel = $langs->trans('CustomerInvoicePayment'); $reflabel = $langs->trans('SocialContribution');
}
if ($reflabel == '(DonationPayment)') {
$reflabel = $langs->trans('Donation');
} }
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
print "<td>" . $reflabel . "</td>"; print "<td>" . $ref . "</td>";
print "<td>" . length_accountg($k) . "</td>"; print "<td>" . length_accountg($k) . "</td>";
// print "<td>" . $langs->trans('Bank') . "</td>";
if ($val['soclib'] == '') { if ($val['soclib'] == '') {
print "<td>" . $langs->trans('Bank') . " - " . $val["ref"] . "</td>"; print "<td>" . $bank_code_journal->label . " - " . $val["ref"] . "</td>";
} else { } else {
print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>"; print "<td>" . $bank_code_journal->label . " - " . $val['soclib'] . "</td>";
} }
print "<td>" . $val["type_payment"] . "</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>";
...@@ -619,19 +623,9 @@ else { ...@@ -619,19 +623,9 @@ else {
if ($k != 'type') { if ($k != 'type') {
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
print "<td>" . $val["soclib"] . "</td>"; print "<td>" . $ref . "</td>";
// print "<td>" . length_accounta($k) . "</td>";
if (length_accounta($k) == '') {
print "<td>" . length_accounta($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) . "</td>";
} else {
print "<td>" . length_accounta($k) . "</td>"; print "<td>" . length_accounta($k) . "</td>";
} print "<td>" . $reflabel . ' ' . $val['soclib'] . "</td>";
// print "<td>" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans('ThirdParty') . " - " . $val["ref"] . "</td>";
} else {
print "<td>" . $langs->trans("ThirdParty") . ' - ' . $val['soclib'] . "</td>";
}
print "<td>" . $val["type_payment"] . "</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 "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
...@@ -642,14 +636,9 @@ else { ...@@ -642,14 +636,9 @@ else {
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
print "<td>" . $reflabel . "</td>"; print "<td>" . $ref . "</td>";
print "<td>" . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . "</td>"; print "<td>" . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . "</td>";
// print "<td>" . $langs->trans('ThirdParty') . "</td>"; print "<td>" . $reflabel . "</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans('ThirdParty') . " - " . $val["ref"] . "</td>";
} else {
print "<td>" . $langs->trans("ThirdParty") . ' - ' . $val['soclib'] . "</td>";
}
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment