25 include
'../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/margin/lib/margins.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30 require_once DOL_DOCUMENT_ROOT.
"/compta/facture/class/facture.class.php";
32 $langs->loadLangs(array(
"admin",
"bills",
"margins",
"stocks"));
36 $action =
GETPOST(
'action',
'aZ09');
43 if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg))
48 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
55 if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg))
60 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
67 if ($action ==
'remises')
69 if (
dolibarr_set_const($db,
'MARGIN_METHODE_FOR_DISCOUNT', $_POST[
'MARGIN_METHODE_FOR_DISCOUNT'],
'chaine', 0,
'', $conf->entity) > 0)
71 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"), null,
'mesgs');
77 if ($action ==
'typemarges')
79 if (
dolibarr_set_const($db,
'MARGIN_TYPE', $_POST[
'MARGIN_TYPE'],
'chaine', 0,
'', $conf->entity) > 0)
81 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"), null,
'mesgs');
87 if ($action ==
'contact')
89 if (
dolibarr_set_const($db,
'AGENT_CONTACT_TYPE', $_POST[
'AGENT_CONTACT_TYPE'],
'chaine', 0,
'', $conf->entity) > 0)
91 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"), null,
'mesgs');
101 $form =
new Form($db);
103 llxHeader(
'', $langs->trans(
"margesSetup"));
106 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
114 print '<table class="noborder centpercent">';
115 print
'<tr class="liste_titre">';
116 print
'<td width=300>'.$langs->trans(
"MemberMainOptions").
'</td>';
117 print
'<td colspan="2">'.$langs->trans(
"Value").
'</td>'.
"\n";
118 print
'<td class="left">'.$langs->trans(
"Description").
'</td>'.
"\n";
122 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
123 print
'<input type="hidden" name="token" value="'.newToken().
'">';
124 print
"<input type=\"hidden\" name=\"action\" value=\"typemarges\">";
125 print
'<tr class="oddeven">';
126 print
'<td>'.$langs->trans(
"MARGIN_TYPE").
'</td>';
128 print
' <input type="radio" name="MARGIN_TYPE" value="1" ';
129 if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'1')
132 print $langs->trans(
'MargeType1');
134 print
' <input type="radio" name="MARGIN_TYPE" value="pmp" ';
135 if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'pmp') print
'checked ';
137 print $langs->trans(
'MargeType2');
139 print
' <input type="radio" name="MARGIN_TYPE" value="costprice" ';
140 if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'costprice') print
'checked ';
142 print $langs->trans(
'MargeType3');
145 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'" class="button">';
147 print
'<td>'.$langs->trans(
'MarginTypeDesc');
153 print
'<tr class="oddeven">';
154 print
'<td>'.$langs->trans(
"DisplayMarginRates").
'</td>';
155 print
'<td colspan="2">';
156 if (!empty($conf->use_javascript_ajax))
160 if (empty($conf->global->DISPLAY_MARGIN_RATES))
162 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_DISPLAY_MARGIN_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
164 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_DISPLAY_MARGIN_RATES&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
168 print
'<td>'.$langs->trans(
'MarginRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'BuyingPrice').
'</td>';
172 print
'<tr class="oddeven">';
173 print
'<td>'.$langs->trans(
"DisplayMarkRates").
'</td>';
174 print
'<td colspan="2">';
175 if (!empty($conf->use_javascript_ajax))
179 if (empty($conf->global->DISPLAY_MARK_RATES))
181 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_DISPLAY_MARK_RATES">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
183 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_DISPLAY_MARK_RATES">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
187 print
'<td>'.$langs->trans(
'MarkRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'SellingPrice').
'</td>';
191 print
'<tr class="oddeven">';
192 print
'<td>'.$langs->trans(
"ForceBuyingPriceIfNull").
'</td>';
193 print
'<td colspan="2">';
194 if (!empty($conf->use_javascript_ajax))
198 if (empty($conf->global->ForceBuyingPriceIfNull))
200 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_ForceBuyingPriceIfNull&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
202 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_ForceBuyingPriceIfNull&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
206 print
'<td>'.$langs->trans(
'ForceBuyingPriceIfNullDetails').
'</td>';
211 1 => $langs->trans(
'UseDiscountAsProduct'),
212 2 => $langs->trans(
'UseDiscountAsService'),
213 3 => $langs->trans(
'UseDiscountOnTotal')
217 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
218 print
'<input type="hidden" name="token" value="'.newToken().
'">';
219 print
"<input type=\"hidden\" name=\"action\" value=\"remises\">";
220 print
'<tr class="oddeven">';
221 print
'<td>'.$langs->trans(
"MARGIN_METHODE_FOR_DISCOUNT").
'</td>';
222 print
'<td class="left">';
223 print
Form::selectarray(
'MARGIN_METHODE_FOR_DISCOUNT', $methods, $conf->global->MARGIN_METHODE_FOR_DISCOUNT);
226 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
228 print
'<td>'.$langs->trans(
'MARGIN_METHODE_FOR_DISCOUNT_DETAILS').
'</td>';
233 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
234 print
'<input type="hidden" name="token" value="'.newToken().
'">';
235 print
"<input type=\"hidden\" name=\"action\" value=\"contact\">";
236 print
'<tr class="oddeven">';
237 print
'<td>'.$langs->trans(
"AgentContactType").
'</td>';
238 print
'<td class="left">';
241 print $formcompany->selectTypeContact($facture, $conf->global->AGENT_CONTACT_TYPE,
"AGENT_CONTACT_TYPE",
"internal",
"code", 1);
244 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
246 print
'<td>'.$langs->trans(
'AgentContactTypeDetails').
'</td>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0)
On/off button for constant.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage invoices.
marges_admin_prepare_head()
Define head array for tabs of marges tools setup pages.