FIX: discount card: only display relevant discounts types (customer/supplier)
This commit is contained in:
parent
876ea3198f
commit
7ca5ac03cc
@ -235,12 +235,17 @@ if ($socid > 0)
|
|||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$object->fetch($socid);
|
$object->fetch($socid);
|
||||||
|
|
||||||
|
$isCustomer = $object->client == 1 || $object->client == 3;
|
||||||
|
$isSupplier = $object->fournisseur == 1;
|
||||||
|
|
||||||
|
$displayCustomer = $conf->global->MAIN_FEATURES_LEVEL <= 0 || $isCustomer;
|
||||||
|
$displaySupplier = $conf->global->MAIN_FEATURES_LEVEL > 0 && $isSupplier;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display tabs
|
* Display tabs
|
||||||
*/
|
*/
|
||||||
$head = societe_prepare_head($object);
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="setremise">';
|
print '<input type="hidden" name="action" value="setremise">';
|
||||||
@ -253,9 +258,23 @@ if ($socid > 0)
|
|||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
|
if(! $displayCustomer && ! $displaySupplier) {
|
||||||
|
print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Calcul avoirs client en cours
|
if($displayCustomer) { // Calcul avoirs client en cours
|
||||||
$remise_all=$remise_user=0;
|
$remise_all=$remise_user=0;
|
||||||
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
|
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||||
@ -284,8 +303,9 @@ if ($socid > 0)
|
|||||||
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
|
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
|
||||||
print '<td>'.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
print '<td>'.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
if($displaySupplier) {
|
||||||
// Calcul avoirs fournisseur en cours
|
// Calcul avoirs fournisseur en cours
|
||||||
$remise_all=$remise_user=0;
|
$remise_all=$remise_user=0;
|
||||||
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
|
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
|
||||||
@ -328,9 +348,18 @@ if ($socid > 0)
|
|||||||
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
|
if($conf->global->MAIN_FEATURES_LEVEL <= 0 || ($isCustomer && ! $isSupplier)) {
|
||||||
|
print '<input type="hidden" name="discount_type" value="0" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($conf->global->MAIN_FEATURES_LEVEL > 0 && (! $isCustomer && $isSupplier)) {
|
||||||
|
print '<input type="hidden" name="discount_type" value="1" />';
|
||||||
|
}
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
if($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
if($conf->global->MAIN_FEATURES_LEVEL > 0 && $isCustomer && $isSupplier) {
|
||||||
print '<tr><td>'.$langs->trans('DiscountType').'</td>';
|
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>';
|
||||||
print '<td><input type="radio" name="discount_type" id="discount_type_0" selected value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
|
print '<td><input type="radio" name="discount_type" id="discount_type_0" selected value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
|
||||||
print ' <input type="radio" name="discount_type" id="discount_type_1" selected value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
|
print ' <input type="radio" name="discount_type" id="discount_type_1" selected value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -379,9 +408,11 @@ if ($socid > 0)
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("DiscountStillRemaining"));
|
print load_fiche_titre($langs->trans("DiscountStillRemaining"));
|
||||||
|
|
||||||
if($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
if($displayCustomer) {
|
||||||
|
if($displaySupplier) {
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
|
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
||||||
@ -401,9 +432,6 @@ if ($socid > 0)
|
|||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
|
||||||
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
|
|
||||||
}
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
||||||
@ -511,11 +539,15 @@ if ($socid > 0)
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
if($displaySupplier) {
|
||||||
|
if($displayCustomer) {
|
||||||
print '</div>'; // class="fichehalfleft"
|
print '</div>'; // class="fichehalfleft"
|
||||||
print '<div class="fichehalfright">';
|
print '<div class="fichehalfright">';
|
||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
|
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Liste remises fixes fournisseur restant en cours (= liees a aucune facture ni ligne de facture)
|
* Liste remises fixes fournisseur restant en cours (= liees a aucune facture ni ligne de facture)
|
||||||
@ -537,7 +569,6 @@ if ($socid > 0)
|
|||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
||||||
@ -646,10 +677,12 @@ if ($socid > 0)
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($displayCustomer) {
|
||||||
print '</div>'; // class="ficheaddleft"
|
print '</div>'; // class="ficheaddleft"
|
||||||
print '</div>'; // class="fichehalfright"
|
print '</div>'; // class="fichehalfright"
|
||||||
print '</div>'; // class="fichecenter"
|
print '</div>'; // class="fichecenter"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -659,9 +692,11 @@ if ($socid > 0)
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("DiscountAlreadyCounted"));
|
print load_fiche_titre($langs->trans("DiscountAlreadyCounted"));
|
||||||
|
|
||||||
if($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
if($displayCustomer) {
|
||||||
|
if($displaySupplier) {
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
|
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remises liees a lignes de factures
|
// Remises liees a lignes de factures
|
||||||
@ -705,9 +740,6 @@ if ($socid > 0)
|
|||||||
if ($resql) $resql2=$db->query($sql2);
|
if ($resql) $resql2=$db->query($sql2);
|
||||||
if ($resql2)
|
if ($resql2)
|
||||||
{
|
{
|
||||||
if($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
|
||||||
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
|
|
||||||
}
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
||||||
@ -809,11 +841,15 @@ if ($socid > 0)
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
if($displaySupplier) {
|
||||||
|
if($displayCustomer) {
|
||||||
print '</div>'; // class="fichehalfleft"
|
print '</div>'; // class="fichehalfleft"
|
||||||
print '<div class="fichehalfright">';
|
print '<div class="fichehalfright">';
|
||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
|
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
||||||
|
}
|
||||||
|
|
||||||
// Remises liees a lignes de factures
|
// Remises liees a lignes de factures
|
||||||
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
||||||
@ -856,7 +892,6 @@ if ($socid > 0)
|
|||||||
if ($resql) $resql2=$db->query($sql2);
|
if ($resql) $resql2=$db->query($sql2);
|
||||||
if ($resql2)
|
if ($resql2)
|
||||||
{
|
{
|
||||||
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
|
||||||
@ -959,11 +994,13 @@ if ($socid > 0)
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($displayCustomer) {
|
||||||
print '</div>'; // class="ficheaddleft"
|
print '</div>'; // class="ficheaddleft"
|
||||||
print '</div>'; // class="fichehalfright"
|
print '</div>'; // class="fichehalfright"
|
||||||
print '</div>'; // class="fichecenter"
|
print '</div>'; // class="fichecenter"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -79,6 +79,7 @@ VATIsUsed=Sales tax is used
|
|||||||
VATIsNotUsed=Sales tax is not used
|
VATIsNotUsed=Sales tax is not used
|
||||||
CopyAddressFromSoc=Fill address with third party address
|
CopyAddressFromSoc=Fill address with third party address
|
||||||
ThirdpartyNotCustomerNotSupplierSoNoRef=Thirdparty neither customer nor supplier, no available refering objects
|
ThirdpartyNotCustomerNotSupplierSoNoRef=Thirdparty neither customer nor supplier, no available refering objects
|
||||||
|
ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts=Thirdparty neither customer nor supplier, discounts are not available
|
||||||
PaymentBankAccount=Payment bank account
|
PaymentBankAccount=Payment bank account
|
||||||
OverAllProposals=Proposals
|
OverAllProposals=Proposals
|
||||||
OverAllOrders=Orders
|
OverAllOrders=Orders
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user