Merge pull request #3683 from aspangaro/develop-68

New : Add payment donation in accountancy expert & presentation
This commit is contained in:
Laurent Destailleur 2015-10-09 20:25:50 +02:00
commit eeac01b794
4 changed files with 96 additions and 88 deletions

View File

@ -40,6 +40,7 @@ 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.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.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.'/compta/paiement/class/paiement.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.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
@ -120,6 +121,7 @@ $paymentsupplierstatic = new PaiementFourn($db);
$societestatic = new Societe($db); $societestatic = new Societe($db);
$userstatic = new User($db); $userstatic = new User($db);
$chargestatic = new ChargeSociales($db); $chargestatic = new ChargeSociales($db);
$paymentdonstatic = new PaymentDonation($db);
$paymentvatstatic = new TVA($db); $paymentvatstatic = new TVA($db);
$paymentsalstatic = new PaymentSalary($db); $paymentsalstatic = new PaymentSalary($db);
@ -133,6 +135,7 @@ if ($result) {
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $cptcli = (! 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")); $accountancy_account_salary = (! 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")); $accountancy_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"));
$tabpay = array (); $tabpay = array ();
$tabbq = array (); $tabbq = array ();
@ -174,7 +177,6 @@ if ($result) {
// get_url may return -1 which is not traversable // get_url may return -1 which is not traversable
if (is_array($links)) if (is_array($links))
{ {
foreach ( $links as $key => $val ) foreach ( $links as $key => $val )
{ {
$tabtype[$obj->rowid] = $links[$key]['type']; $tabtype[$obj->rowid] = $links[$key]['type'];
@ -238,6 +240,13 @@ if ($result) {
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
} }
} }
else if ($links[$key]['type'] == 'payment_donation')
{
$paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation");
$tabtp[$obj->rowid][$accountancy_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'];
@ -262,7 +271,6 @@ if ($result) {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/ }*/
} }
} }
$tabbq[$obj->rowid][$compta_bank] += $obj->amount; $tabbq[$obj->rowid][$compta_bank] += $obj->amount;

View File

@ -280,7 +280,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$sortorder $sortorder
); );
} else { } else {
print '<td colspan="1"></td>'; print_liste_field_titre('');
} }
print_liste_field_titre( print_liste_field_titre(
$langs->trans("AmountTTC"), $langs->trans("AmountTTC"),

View File

@ -350,7 +350,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$sortorder $sortorder
); );
} else { } else {
print '<td colspan="1"></td>'; print_liste_field_titre('');
} }
print_liste_field_titre( print_liste_field_titre(
$langs->trans("AmountTTC"), $langs->trans("AmountTTC"),