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"));
38 $action =
GETPOST(
'action',
'aZ09');
46 if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
49 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
56 if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
59 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
66 if ($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');
74 if ($action ==
'typemarges') {
76 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
82 if ($action ==
'contact') {
84 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
96 llxHeader(
'', $langs->trans(
"margesSetup"));
99 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
100 print
load_fiche_titre($langs->trans(
"margesSetup"), $linkback,
'title_setup');
105 print
dol_get_fiche_head($head,
'parameters', $langs->trans(
"Margins"), -1,
'margin');
107 print
'<table class="noborder centpercent">';
108 print
'<tr class="liste_titre">';
109 print
'<td width=300>'.$langs->trans(
"MemberMainOptions").
'</td>';
110 print
'<td colspan="2">'.$langs->trans(
"Value").
'</td>'.
"\n";
111 print
'<td class="left">'.$langs->trans(
"Description").
'</td>'.
"\n";
115 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
116 print
'<input type="hidden" name="token" value="'.newToken().
'">';
117 print
"<input type=\"hidden\" name=\"action\" value=\"typemarges\">";
118 print
'<tr class="oddeven">';
119 print
'<td>'.$langs->trans(
"MARGIN_TYPE").
'</td>';
121 print
' <input type="radio" name="MARGIN_TYPE" value="1" ';
122 if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'1') {
126 print $langs->trans(
'MargeType1');
128 print
' <input type="radio" name="MARGIN_TYPE" value="pmp" ';
129 if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'pmp') {
133 print $langs->trans(
'MargeType2');
135 print
' <input type="radio" name="MARGIN_TYPE" value="costprice" ';
136 if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'costprice') {
140 print $langs->trans(
'MargeType3');
143 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" class="button">';
145 print
'<td>'.$langs->trans(
'MarginTypeDesc');
151 print
'<tr class="oddeven">';
152 print
'<td>'.$langs->trans(
"DisplayMarginRates").
'</td>';
153 print
'<td colspan="2">';
154 if (!empty($conf->use_javascript_ajax)) {
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>';
164 print
'<td>'.$langs->trans(
'MarginRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'BuyingPrice').
'</td>';
168 print
'<tr class="oddeven">';
169 print
'<td>'.$langs->trans(
"DisplayMarkRates").
'</td>';
170 print
'<td colspan="2">';
171 if (!empty($conf->use_javascript_ajax)) {
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>';
181 print
'<td>'.$langs->trans(
'MarkRate').
' = '.$langs->trans(
'Margin').
' / '.$langs->trans(
'SellingPrice').
'</td>';
185 print
'<tr class="oddeven">';
186 print
'<td>'.$langs->trans(
"ForceBuyingPriceIfNull").
'</td>';
187 print
'<td colspan="2">';
188 if (!empty($conf->use_javascript_ajax)) {
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>';
198 print
'<td>'.$langs->trans(
'ForceBuyingPriceIfNullDetails').
'</td>';
203 1 => $langs->trans(
'UseDiscountAsProduct'),
204 2 => $langs->trans(
'UseDiscountAsService'),
205 3 => $langs->trans(
'UseDiscountOnTotal')
209 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
210 print
'<input type="hidden" name="token" value="'.newToken().
'">';
211 print
'<input type="hidden" name="action" value="remises">';
212 print
'<tr class="oddeven">';
213 print
'<td>'.$langs->trans(
"MARGIN_METHODE_FOR_DISCOUNT").
'</td>';
214 print
'<td class="left">';
218 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
220 print
'<td>'.$langs->trans(
'MARGIN_METHODE_FOR_DISCOUNT_DETAILS').
'</td>';
225 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
226 print
'<input type="hidden" name="token" value="'.newToken().
'">';
227 print
'<input type="hidden" name="action" value="contact">';
228 print
'<tr class="oddeven">';
229 print
'<td>'.$langs->trans(
"AgentContactType").
'</td>';
230 print
'<td class="left">';
233 print $formcompany->selectTypeContact($facture,
getDolGlobalString(
'AGENT_CONTACT_TYPE'),
"AGENT_CONTACT_TYPE",
"internal",
"code", 1,
"maxwidth250");
236 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
238 print
'<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.
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='')
On/off button for 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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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='')
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) 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.