';
- }
-
- // Remises liees a lignes de factures
- $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
- $sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
- $sql.= " rc.fk_facture_source,";
- $sql.= " u.login, u.rowid as user_id,";
- $sql.= " f.rowid, f.facnumber,";
- $sql.= " fa.facnumber as ref, fa.type as type";
- $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
- $sql.= " , ".MAIN_DB_PREFIX."user as u";
- $sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
- $sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
- $sql.= " WHERE rc.fk_soc =". $object->id;
- $sql.= " AND rc.fk_facture_line = fc.rowid";
- $sql.= " AND fc.fk_facture = f.rowid";
- $sql.= " AND rc.fk_user = u.rowid";
- $sql.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
- $sql.= " ORDER BY dc DESC";
- //$sql.= " UNION ";
- // Remises liees a factures
- $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
- $sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
- $sql2.= " rc.fk_facture_source,";
- $sql2.= " u.login, u.rowid as user_id,";
- $sql2.= " f.rowid, f.facnumber,";
- $sql2.= " fa.facnumber as ref, fa.type as type";
- $sql2.= " FROM ".MAIN_DB_PREFIX."facture as f";
- $sql2.= " , ".MAIN_DB_PREFIX."user as u";
- $sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
- $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
- $sql2.= " WHERE rc.fk_soc =". $object->id;
- $sql2.= " AND rc.fk_facture = f.rowid";
- $sql2.= " AND rc.fk_user = u.rowid";
- $sql2.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
- $sql2.= " ORDER BY dc DESC";
-
- $resql=$db->query($sql);
- $resql2=null;
- if ($resql) $resql2=$db->query($sql2);
- if ($resql2)
- {
- if($conf->global->MAIN_FEATURES_LEVEL > 0) {
+ if($displayCustomer) {
+ if($displaySupplier) {
+ print '
';
+ print '
';
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
}
- print '
';
- print '';
- print '| '.$langs->trans("Date").' | '; // Need 120+ for format with AM/PM
- print ''.$langs->trans("ReasonDiscount").' | ';
- print ''.$langs->trans("ConsumedBy").' | ';
- print ''.$langs->trans("AmountHT").' | ';
- print ''.$langs->trans("VATRate").' | ';
- print ''.$langs->trans("AmountTTC").' | ';
- print ''.$langs->trans("Author").' | ';
- print ' | ';
- print '
';
- $tab_sqlobj=array();
- $tab_sqlobjOrder=array();
- $num = $db->num_rows($resql);
- if ($num > 0)
+ // Remises liees a lignes de factures
+ $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
+ $sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
+ $sql.= " rc.fk_facture_source,";
+ $sql.= " u.login, u.rowid as user_id,";
+ $sql.= " f.rowid, f.facnumber,";
+ $sql.= " fa.facnumber as ref, fa.type as type";
+ $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
+ $sql.= " , ".MAIN_DB_PREFIX."user as u";
+ $sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
+ $sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
+ $sql.= " WHERE rc.fk_soc =". $object->id;
+ $sql.= " AND rc.fk_facture_line = fc.rowid";
+ $sql.= " AND fc.fk_facture = f.rowid";
+ $sql.= " AND rc.fk_user = u.rowid";
+ $sql.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
+ $sql.= " ORDER BY dc DESC";
+ //$sql.= " UNION ";
+ // Remises liees a factures
+ $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
+ $sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
+ $sql2.= " rc.fk_facture_source,";
+ $sql2.= " u.login, u.rowid as user_id,";
+ $sql2.= " f.rowid, f.facnumber,";
+ $sql2.= " fa.facnumber as ref, fa.type as type";
+ $sql2.= " FROM ".MAIN_DB_PREFIX."facture as f";
+ $sql2.= " , ".MAIN_DB_PREFIX."user as u";
+ $sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
+ $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
+ $sql2.= " WHERE rc.fk_soc =". $object->id;
+ $sql2.= " AND rc.fk_facture = f.rowid";
+ $sql2.= " AND rc.fk_user = u.rowid";
+ $sql2.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
+ $sql2.= " ORDER BY dc DESC";
+
+ $resql=$db->query($sql);
+ $resql2=null;
+ if ($resql) $resql2=$db->query($sql2);
+ if ($resql2)
{
- for ($i = 0;$i < $num; $i++)
- {
- $sqlobj = $db->fetch_object($resql);
- $tab_sqlobj[] = $sqlobj;
- $tab_sqlobjOrder[]=$db->jdate($sqlobj->dc);
- }
- }
- $db->free($resql);
-
- $num = $db->num_rows($resql2);
- for ($i = 0;$i < $num;$i++)
- {
- $sqlobj = $db->fetch_object($resql2);
- $tab_sqlobj[] = $sqlobj;
- $tab_sqlobjOrder[]= $db->jdate($sqlobj->dc);
- }
- $db->free($resql2);
- array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);
-
- $num = count($tab_sqlobj);
- if ($num > 0)
- {
- $i = 0 ;
- while ($i < $num )
- {
- $obj = array_shift($tab_sqlobj);
- print '';
- print '| '.dol_print_date($db->jdate($obj->dc),'dayhour').' | ';
- if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
- {
- print '';
- $facturestatic->id=$obj->fk_facture_source;
- $facturestatic->ref=$obj->ref;
- $facturestatic->type=$obj->type;
- print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1);
- print ' | ';
- }
- elseif (preg_match('/\(DEPOSIT\)/',$obj->description))
- {
- print '';
- $facturestatic->id=$obj->fk_facture_source;
- $facturestatic->ref=$obj->ref;
- $facturestatic->type=$obj->type;
- print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1);
- print ' | ';
- }
- elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description))
- {
- print '';
- $facturestatic->id=$obj->fk_facture_source;
- $facturestatic->ref=$obj->ref;
- $facturestatic->type=$obj->type;
- print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1);
- print ' | ';
- }
- else
- {
- print '';
- print $obj->description;
- print ' | ';
- }
- print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.' | ';
- print ''.price($obj->amount_ht).' | ';
- print ''.price2num($obj->tva_tx,'MU').'% | ';
- print ''.price($obj->amount_ttc).' | ';
- print '';
- print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'';
- print ' | ';
- print ' | ';
- print '
';
- $i++;
- }
+ print '';
+ print '';
+ print '| '.$langs->trans("Date").' | '; // Need 120+ for format with AM/PM
+ print ''.$langs->trans("ReasonDiscount").' | ';
+ print ''.$langs->trans("ConsumedBy").' | ';
+ print ''.$langs->trans("AmountHT").' | ';
+ print ''.$langs->trans("VATRate").' | ';
+ print ''.$langs->trans("AmountTTC").' | ';
+ print ''.$langs->trans("Author").' | ';
+ print ' | ';
+ print '
';
+
+ $tab_sqlobj=array();
+ $tab_sqlobjOrder=array();
+ $num = $db->num_rows($resql);
+ if ($num > 0)
+ {
+ for ($i = 0;$i < $num; $i++)
+ {
+ $sqlobj = $db->fetch_object($resql);
+ $tab_sqlobj[] = $sqlobj;
+ $tab_sqlobjOrder[]=$db->jdate($sqlobj->dc);
+ }
+ }
+ $db->free($resql);
+
+ $num = $db->num_rows($resql2);
+ for ($i = 0;$i < $num;$i++)
+ {
+ $sqlobj = $db->fetch_object($resql2);
+ $tab_sqlobj[] = $sqlobj;
+ $tab_sqlobjOrder[]= $db->jdate($sqlobj->dc);
+ }
+ $db->free($resql2);
+ array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);
+
+ $num = count($tab_sqlobj);
+ if ($num > 0)
+ {
+ $i = 0 ;
+ while ($i < $num )
+ {
+ $obj = array_shift($tab_sqlobj);
+ print '';
+ print '| '.dol_print_date($db->jdate($obj->dc),'dayhour').' | ';
+ if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
+ {
+ print '';
+ $facturestatic->id=$obj->fk_facture_source;
+ $facturestatic->ref=$obj->ref;
+ $facturestatic->type=$obj->type;
+ print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1);
+ print ' | ';
+ }
+ elseif (preg_match('/\(DEPOSIT\)/',$obj->description))
+ {
+ print '';
+ $facturestatic->id=$obj->fk_facture_source;
+ $facturestatic->ref=$obj->ref;
+ $facturestatic->type=$obj->type;
+ print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1);
+ print ' | ';
+ }
+ elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description))
+ {
+ print '';
+ $facturestatic->id=$obj->fk_facture_source;
+ $facturestatic->ref=$obj->ref;
+ $facturestatic->type=$obj->type;
+ print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1);
+ print ' | ';
+ }
+ else
+ {
+ print '';
+ print $obj->description;
+ print ' | ';
+ }
+ print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.' | ';
+ print ''.price($obj->amount_ht).' | ';
+ print ''.price2num($obj->tva_tx,'MU').'% | ';
+ print ''.price($obj->amount_ttc).' | ';
+ print '';
+ print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'';
+ print ' | ';
+ print ' | ';
+ print '
';
+ $i++;
+ }
+ }
+ else
+ {
+ print '| '.$langs->trans("None").' |
';
+ }
+
+ print "
";
}
else
{
- print '| '.$langs->trans("None").' |
';
+ dol_print_error($db);
}
-
- print "
";
- }
- else
- {
- dol_print_error($db);
}
- if($conf->global->MAIN_FEATURES_LEVEL > 0) {
- print '
'; // class="fichehalfleft"
- print '
';
- print '
';
+ if($displaySupplier) {
+ if($displayCustomer) {
+ print '
'; // class="fichehalfleft"
+ print '
';
+ print '
';
+ print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
+ }
// Remises liees a lignes de factures
$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 ($resql2)
{
- print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
print '
';
print '';
print '| '.$langs->trans("Date").' | '; // Need 120+ for format with AM/PM
@@ -958,10 +993,12 @@ if ($socid > 0)
{
dol_print_error($db);
}
-
- print ''; // class="ficheaddleft"
- print ''; // class="fichehalfright"
- print ''; // class="fichecenter"
+
+ if($displayCustomer) {
+ print ''; // class="ficheaddleft"
+ print ''; // class="fichehalfright"
+ print ''; // class="fichecenter"
+ }
}
}
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 2eb1ba88e57..dde515c0223 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -79,6 +79,7 @@ VATIsUsed=Sales tax is used
VATIsNotUsed=Sales tax is not used
CopyAddressFromSoc=Fill address with third party address
ThirdpartyNotCustomerNotSupplierSoNoRef=Thirdparty neither customer nor supplier, no available refering objects
+ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts=Thirdparty neither customer nor supplier, discounts are not available
PaymentBankAccount=Payment bank account
OverAllProposals=Proposals
OverAllOrders=Orders