25include
'../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/margin/lib/margins.lib.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.
"/compta/facture/class/facture.class.php";
32$langs->loadLangs(array(
"admin",
"bills",
"margins",
"stocks"));
38$action =
GETPOST(
'action',
'aZ09');
46if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
49 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
56if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
59 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
66if ($action ==
'remises') {
67 if (
dolibarr_set_const($db,
'MARGIN_METHODE_FOR_DISCOUNT',
GETPOST(
'MARGIN_METHODE_FOR_DISCOUNT'),
'chaine', 0,
'', $conf->entity) > 0) {
68 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
74if ($action ==
'typemarges') {
76 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
82if ($action ==
'contact') {
84 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
96llxHeader(
'', $langs->trans(
"margesSetup"));
99$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
100print
load_fiche_titre($langs->trans(
"margesSetup"), $linkback,
'title_setup');
107print
'<table class="noborder centpercent">';
108print
'<tr class="liste_titre">';
109print
'<td width=300>'.$langs->trans(
"MemberMainOptions").
'</td>';
110print
'<td colspan="2">'.$langs->trans(
"Value").
'</td>'.
"\n";
111print
'<td class="left">'.$langs->trans(
"Description").
'</td>'.
"\n";
115print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
116print
'<input type="hidden" name="token" value="'.newToken().
'">';
117print
"<input type=\"hidden\" name=\"action\" value=\"typemarges\">";
118print
'<tr class="oddeven">';
119print
'<td>'.$langs->trans(
"MARGIN_TYPE").
'</td>';
121print
' <input type="radio" name="MARGIN_TYPE" value="1" ';
122if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'1') {
126print $langs->trans(
'MargeType1');
128print
' <input type="radio" name="MARGIN_TYPE" value="pmp" ';
129if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'pmp') {
133print $langs->trans(
'MargeType2');
135print
' <input type="radio" name="MARGIN_TYPE" value="costprice" ';
136if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'costprice') {
140print $langs->trans(
'MargeType3');
143print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" class="button">';
145print
'<td>'.$langs->trans(
'MarginTypeDesc');
151print
'<tr class="oddeven">';
152print
'<td>'.$langs->trans(
"DisplayMarginRates").
'</td>';
153print
'<td colspan="2">';
154if (!empty($conf->use_javascript_ajax)) {
155 print ajax_constantonoff(
'DISPLAY_MARGIN_RATES');
157 if (empty($conf->global->DISPLAY_MARGIN_RATES)) {
158 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_DISPLAY_MARGIN_RATES&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
160 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_DISPLAY_MARGIN_RATES&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
164print
'<td>'.$langs->trans(
'MarginRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'BuyingPrice').
'</td>';
168print
'<tr class="oddeven">';
169print
'<td>'.$langs->trans(
"DisplayMarkRates").
'</td>';
170print
'<td colspan="2">';
171if (!empty($conf->use_javascript_ajax)) {
172 print ajax_constantonoff(
'DISPLAY_MARK_RATES');
174 if (empty($conf->global->DISPLAY_MARK_RATES)) {
175 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_DISPLAY_MARK_RATES&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
177 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_DISPLAY_MARK_RATES&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
181print
'<td>'.$langs->trans(
'MarkRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'SellingPrice').
'</td>';
185print
'<tr class="oddeven">';
186print
'<td>'.$langs->trans(
"ForceBuyingPriceIfNull").
'</td>';
187print
'<td colspan="2">';
188if (!empty($conf->use_javascript_ajax)) {
189 print ajax_constantonoff(
'ForceBuyingPriceIfNull');
191 if (empty($conf->global->ForceBuyingPriceIfNull)) {
192 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_ForceBuyingPriceIfNull&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
194 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_ForceBuyingPriceIfNull&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
198print
'<td>'.$langs->trans(
'ForceBuyingPriceIfNullDetails').
'</td>';
203 1 => $langs->trans(
'UseDiscountAsProduct'),
204 2 => $langs->trans(
'UseDiscountAsService'),
205 3 => $langs->trans(
'UseDiscountOnTotal')
209print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
210print
'<input type="hidden" name="token" value="'.newToken().
'">';
211print
'<input type="hidden" name="action" value="remises">';
212print
'<tr class="oddeven">';
213print
'<td>'.$langs->trans(
"MARGIN_METHODE_FOR_DISCOUNT").
'</td>';
214print
'<td class="left">';
218print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
220print
'<td>'.$langs->trans(
'MARGIN_METHODE_FOR_DISCOUNT_DETAILS').
'</td>';
225print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
226print
'<input type="hidden" name="token" value="'.newToken().
'">';
227print
'<input type="hidden" name="action" value="contact">';
228print
'<tr class="oddeven">';
229print
'<td>'.$langs->trans(
"AgentContactType").
'</td>';
230print
'<td class="left">';
233print $formcompany->selectTypeContact($facture,
getDolGlobalString(
'AGENT_CONTACT_TYPE'),
"AGENT_CONTACT_TYPE",
"internal",
"code", 1,
"maxwidth250");
236print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
238print
'<td>'.$langs->trans(
'AgentContactTypeDetails').
'</td>';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage invoices.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
marges_admin_prepare_head()
Define head array for tabs of marges tools setup pages.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.