26include
'../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/margin/lib/margins.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
31require_once DOL_DOCUMENT_ROOT.
"/compta/facture/class/facture.class.php";
41$langs->loadLangs(array(
"admin",
"bills",
"margins",
"stocks"));
47$action =
GETPOST(
'action',
'aZ09');
55if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
58 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
65if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
68 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
75if ($action ==
'remises') {
77 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
83if ($action ==
'typemarges') {
85 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
91if ($action ==
'contact') {
93 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
103$form =
new Form($db);
105llxHeader(
'', $langs->trans(
"margesSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-margin page-admin_margin');
108$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
109print
load_fiche_titre($langs->trans(
"margesSetup"), $linkback,
'title_setup');
116print
'<table class="noborder centpercent">';
117print
'<tr class="liste_titre">';
118print
'<td width=300>'.$langs->trans(
"MemberMainOptions").
'</td>';
119print
'<td colspan="2">'.$langs->trans(
"Value").
'</td>'.
"\n";
120print
'<td class="left">'.$langs->trans(
"Description").
'</td>'.
"\n";
124print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
125print
'<input type="hidden" name="token" value="'.newToken().
'">';
126print
"<input type=\"hidden\" name=\"action\" value=\"typemarges\">";
127print
'<tr class="oddeven">';
128print
'<td>'.$langs->trans(
"MARGIN_TYPE").
'</td>';
130print
' <input type="radio" name="MARGIN_TYPE" value="1" ';
135print $langs->trans(
'MargeType1');
137print
' <input type="radio" name="MARGIN_TYPE" value="pmp" ';
142print $langs->trans(
'MargeType2');
144print
' <input type="radio" name="MARGIN_TYPE" value="costprice" ';
149print $langs->trans(
'MargeType3');
152print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" class="button">';
154print
'<td>'.$langs->trans(
'MarginTypeDesc');
160print
'<tr class="oddeven">';
161print
'<td>'.$langs->trans(
"DisplayMarginRates").
'</td>';
162print
'<td colspan="2">';
163if (!empty(
$conf->use_javascript_ajax)) {
164 print ajax_constantonoff(
'DISPLAY_MARGIN_RATES');
167 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_DISPLAY_MARGIN_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
169 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_DISPLAY_MARGIN_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
173print
'<td>'.$langs->trans(
'MarginRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'BuyingPrice').
'</td>';
177print
'<tr class="oddeven">';
178print
'<td>'.$langs->trans(
"DisplayMarkRates").
'</td>';
179print
'<td colspan="2">';
180if (!empty(
$conf->use_javascript_ajax)) {
181 print ajax_constantonoff(
'DISPLAY_MARK_RATES');
184 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_DISPLAY_MARK_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
186 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_DISPLAY_MARK_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
190print
'<td>'.$langs->trans(
'MarkRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'SellingPrice').
'</td>';
194print
'<tr class="oddeven">';
195print
'<td>'.$langs->trans(
"ForceBuyingPriceIfNull").
'</td>';
196print
'<td colspan="2">';
197if (!empty(
$conf->use_javascript_ajax)) {
198 print ajax_constantonoff(
'ForceBuyingPriceIfNull');
201 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_ForceBuyingPriceIfNull&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
203 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_ForceBuyingPriceIfNull&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
207print
'<td>'.$langs->trans(
'ForceBuyingPriceIfNullDetails').
'</td>';
212 1 => $langs->trans(
'UseDiscountAsProduct'),
213 2 => $langs->trans(
'UseDiscountAsService'),
214 3 => $langs->trans(
'UseDiscountOnTotal')
218print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
219print
'<input type="hidden" name="token" value="'.newToken().
'">';
220print
'<input type="hidden" name="action" value="remises">';
221print
'<tr class="oddeven">';
222print
'<td>'.$langs->trans(
"MARGIN_METHODE_FOR_DISCOUNT").
'</td>';
223print
'<td class="left">';
227print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
229print
'<td>'.$langs->trans(
'MARGIN_METHODE_FOR_DISCOUNT_DETAILS').
'</td>';
234print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
235print
'<input type="hidden" name="token" value="'.newToken().
'">';
236print
'<input type="hidden" name="action" value="contact">';
237print
'<tr class="oddeven">';
238print
'<td>'.$langs->trans(
"AgentContactType").
'</td>';
239print
'<td class="left">';
242print $formcompany->selectTypeContact($facture,
getDolGlobalString(
'AGENT_CONTACT_TYPE'),
"AGENT_CONTACT_TYPE",
"internal",
"code", 1,
"maxwidth250");
245print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
247print
'<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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoices.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
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)
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
marges_admin_prepare_head()
Define head array for tabs of marges tools setup pages.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.