26require_once
'../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/margin/lib/margins.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37require_once DOL_DOCUMENT_ROOT.
"/compta/facture/class/facture.class.php";
39$langs->loadLangs(array(
"admin",
"bills",
"margins",
"stocks"));
45$action =
GETPOST(
'action',
'aZ09');
53if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
56 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
63if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
66 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
73if ($action ==
'update') {
75 if (
dolibarr_set_const($db,
'MARGIN_METHODE_FOR_DISCOUNT',
GETPOST(
'MARGIN_METHODE_FOR_DISCOUNT'),
'chaine', 0,
'', $conf->entity) <= 0) {
91 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
100$form =
new Form($db);
102llxHeader(
'', $langs->trans(
"margesSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-margin page-admin_margin');
105$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
106print
load_fiche_titre($langs->trans(
"margesSetup"), $linkback,
'title_setup');
113print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
114print
'<input type="hidden" name="token" value="'.newToken().
'">';
115print
'<input type="hidden" name="action" value="update">';
117print
'<div class="div-table-responsive">';
118print
'<table class="noborder centpercent">';
119print
'<tr class="liste_titre">';
120print
'<td colspan="3">'.$langs->trans(
"MemberMainOptions").
'</td>';
124print
'<tr class="oddeven">';
125print
'<td>'.$langs->trans(
"MARGIN_TYPE").
'</td>';
126print
'<td class="minwidth150">';
127print
' <input type="radio" name="MARGIN_TYPE" id="MARGIN_TYPE1" value="1" ';
132print
'<label for="MARGIN_TYPE1">'.$langs->trans(
'MargeType1').
'</label>';
134print
' <input type="radio" name="MARGIN_TYPE" id="MARGIN_TYPE2" value="pmp" ';
139print
'<label for="MARGIN_TYPE2">'.$langs->trans(
'MargeType2').
'</label>';
141print
' <input type="radio" name="MARGIN_TYPE" id="MARGIN_TYPE3" value="costprice" ';
146print
'<label for="MARGIN_TYPE3">'.$langs->trans(
'MargeType3').
'</label>';
148print
'<td class="minwidth200"><span class="small">'.$langs->trans(
'MarginTypeDesc').
'</span>';
153print
'<tr class="oddeven">';
154print
'<td>'.$langs->trans(
"DisplayMarginRates").
'</td>';
156if (!empty($conf->use_javascript_ajax)) {
157 print ajax_constantonoff(
'DISPLAY_MARGIN_RATES');
160 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_DISPLAY_MARGIN_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
162 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_DISPLAY_MARGIN_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
166print
'<td><span class="small">'.$langs->trans(
'MarginRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'BuyingPrice').
'</span></td>';
170print
'<tr class="oddeven">';
171print
'<td>'.$langs->trans(
"DisplayMarkRates").
'</td>';
173if (!empty($conf->use_javascript_ajax)) {
174 print ajax_constantonoff(
'DISPLAY_MARK_RATES');
177 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_DISPLAY_MARK_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
179 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_DISPLAY_MARK_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
183print
'<td><span class="small">'.$langs->trans(
'MarkRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'SellingPrice').
'</span></td>';
187print
'<tr class="oddeven">';
188print
'<td>'.$langs->trans(
"ForceBuyingPriceIfNull").
'</td>';
190if (!empty($conf->use_javascript_ajax)) {
191 print ajax_constantonoff(
'ForceBuyingPriceIfNull');
194 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_ForceBuyingPriceIfNull&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
196 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_ForceBuyingPriceIfNull&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
200print
'<td><span class="small">'.$langs->trans(
'ForceBuyingPriceIfNullDetails').
'</span></td>';
205 1 => $langs->trans(
'UseDiscountAsProduct'),
206 2 => $langs->trans(
'UseDiscountAsService'),
207 3 => $langs->trans(
'UseDiscountOnTotal')
211print
'<tr class="oddeven">';
212print
'<td>'.$langs->trans(
"MARGIN_METHODE_FOR_DISCOUNT").
'</td>';
213print
'<td class="left">';
216print
'<td><span class="small">'.$langs->trans(
'MARGIN_METHODE_FOR_DISCOUNT_DETAILS').
'</span></td>';
220print
'<tr class="oddeven">';
221print
'<td>'.$langs->trans(
"AgentContactType").
'</td>';
222print
'<td class="left">';
225print $formcompany->selectTypeContact($facture,
getDolGlobalString(
'AGENT_CONTACT_TYPE'),
"AGENT_CONTACT_TYPE",
"internal",
"code", 1,
"maxwidth250");
227print
'<td><span class="small">'.$langs->trans(
'AgentContactTypeDetails').
'</span></td>';
233print
'<center><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" class="button"></center>';
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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoices.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a 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.