altocompta/include/company.inc.php
Dany De Bontridder 0030779e71 Merge branch 'dev7109' into entreprise
# Conflicts:
#	html/install.php
#	include/class/acc_ledger.class.php
#	include/class/noalyss_parameter_folder.class.php
#	include/company.inc.php
2019-09-12 21:57:47 +02:00

199 lines
8.2 KiB
PHP

<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!
* \file
*\brief Manage the company setting : address, vat number, Check period, VAT,
* CA ....
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
global $g_user;
$http=new HttpInput();
echo '<div class="content">';
require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
if (isset($_POST['record_company']))
{
$m = new Noalyss_Parameter_Folder($cn);
$m->MY_NAME = $http->post("p_name");
$m->MY_TVA = $http->post("p_tva");
$m->MY_STREET = $http->post("p_street");
$m->MY_NUMBER = $http->post("p_no");
$m->MY_CP = $http->post("p_cp");
$m->MY_COMMUNE = $http->post("p_Commune");
$m->MY_TEL = $http->post("p_tel");
$m->MY_FAX = $http->post("p_fax");
$m->MY_PAYS = $http->post("p_pays");
$m->MY_CHECK_PERIODE =$http->post("p_check_periode");
$m->MY_DATE_SUGGEST = $http->post("p_date_suggest");
$m->MY_ANALYTIC =$http->post("p_compta");
$m->MY_STRICT = $http->post("p_strict");
$m->MY_TVA_USE = $http->post("p_tva_use");
$m->MY_PJ_SUGGEST = $http->post("p_pj");
$m->MY_ALPHANUM = $http->post("p_alphanum");
$m->MY_UPDLAB = $http->post("p_updlab");
$m->MY_STOCK =$http->post("p_stock");
$m->MY_CURRENCY =$http->post("p_currency");
$m->MY_DEFAULT_ROUND_ERROR_DEB=$http->post("p_round_error_deb");
$m->MY_DEFAULT_ROUND_ERROR_CRED=$http->post("p_round_error_cred");
$m->MY_ANC_FILTER=$http->post("p_anc_filter");
try{
$m->Update();
} catch (Exception $e) {
alert($e->getMessage());
}
}
$my = new Noalyss_Parameter_Folder($cn);
///// Compta analytic
$array = array(
array("value" => "ob", 'label' => _("obligatoire")),
array("value" => "op", 'label' => _("optionnel")),
array("value" => "nu", 'label' => _("non utilisé"))
);
$strict_array = array(
array('value' => 'N', 'label' => _('Non')),
array('value' => 'Y', 'label' => _('Oui'))
);
$alpha_num_array[0] = array('value' => 'N', 'label' => _('Non'));
$alpha_num_array[1] = array('value' => 'Y', 'label' => _('Oui'));
$updlab_array[0] = array('value' => 'N', 'label' => _('Non'));
$updlab_array[1] = array('value' => 'Y', 'label' => _('Oui'));
$compta = new ISelect();
$compta->table = 1;
$compta->selected = $my->MY_ANALYTIC;
$strict = new ISelect();
$strict->table = 1;
$strict->selected = $my->MY_STRICT;
$tva_use = new ISelect();
$tva_use->table = 1;
$tva_use->selected = $my->MY_TVA_USE;
$pj_suggest = new ISelect();
$pj_suggest->table = 1;
$pj_suggest->selected = $my->MY_PJ_SUGGEST;
$date_suggest = new ISelect();
$date_suggest->table = 1;
$date_suggest->selected = $my->MY_DATE_SUGGEST;
$check_periode = new ISelect();
$check_periode->table = 1;
$check_periode->selected = $my->MY_CHECK_PERIODE;
$alpha_num = new ISelect();
$alpha_num->table = 1;
$alpha_num->value = $alpha_num_array;
$alpha_num->selected = $my->MY_ALPHANUM;
$updlab = new ISelect();
$updlab->table = 1;
$updlab->value = $updlab_array;
$updlab->selected = $my->MY_UPDLAB;
$stock = new ISelect('p_stock');
$stock->value = array(
array('value' => 'N', 'label' => _('Non')),
array('value' => 'Y', 'label' => _('Oui'))
);
$stock->selected = $my->MY_STOCK;
$stock->table = 1;
$anc_filter=new IText("p_anc_filter", $my->MY_ANC_FILTER);
$anc_filter->placeholder='6,7';
$anc_filter->title=_("Uniquement des chiffres séparés par des virgules");
$use_currency= new ISelect();
$use_currency->table = 1;
$use_currency->value = $updlab_array;
$use_currency->selected = $my->MY_CURRENCY;
$default_error_deb=new IPoste("p_round_error_deb",$my->MY_DEFAULT_ROUND_ERROR_DEB);
$default_error_deb->name = 'p_round_error_deb';
$default_error_deb->set_attribute('gDossier',Dossier::id());
$default_error_deb->set_attribute('jrn',0);
$default_error_deb->set_attribute('account','p_round_error_deb');
$default_error_cred=new IPoste("p_round_error_deb",$my->MY_DEFAULT_ROUND_ERROR_CRED);
$default_error_cred->name = 'p_round_error_cred';
$default_error_cred->set_attribute('gDossier',Dossier::id());
$default_error_cred->set_attribute('jrn',0);
$default_error_cred->set_attribute('account','p_round_error_cred');
// other parameters
$all = new IText();
$all->table = 1;
echo '<form method="post" >';
echo dossier::hidden();
echo "<table class=\"result\" style=\"width:auto\">";
echo "<tr>" . td(_('Nom société'), 'style="text-align:right"') . $all->input("p_name", $my->MY_NAME) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Téléphone"), 'style="text-align:right"') . $all->input("p_tel", $my->MY_TEL) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Fax"), 'style="text-align:right"') . $all->input("p_fax", $my->MY_FAX) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Rue "), 'style="text-align:right"') . $all->input("p_street", $my->MY_STREET) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Numéro"), 'style="text-align:right"') . $all->input("p_no", $my->MY_NUMBER) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Code Postal"), 'style="text-align:right"') . $all->input("p_cp", $my->MY_CP) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Commune"), 'style="text-align:right"') . $all->input("p_Commune", $my->MY_COMMUNE) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Pays"), 'style="text-align:right"') . $all->input("p_pays", $my->MY_PAYS) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Numéro de Tva"), 'style="text-align:right"') . $all->input("p_tva", $my->MY_TVA) . "</tr>";
echo "<tr>" . td(_("Utilisation de la compta. analytique"), 'style="text-align:right"') . $compta->input("p_compta", $array) . "</tr>";
echo '<tr>'. td(_("Opération analytique uniquement pour les postes comptables commençant par")).
'<td>'.
$anc_filter->input().
Icon_Action::tips($anc_filter->title);
'</td>'.
'</tr>';
echo "<tr>" . td(_("Utilisation des stocks"), 'style="text-align:right"') . $stock->input() . "</tr>";
echo "<tr>" . td(_("Utilisation de devises étrangères"), 'style="text-align:right"') . $use_currency->input("p_currency", $strict_array) . "</tr>";
echo "<tr>" . td(_("Utilisation du mode strict "), 'style="text-align:right"') . $strict->input("p_strict", $strict_array) . "</tr>";
echo "<tr>" . td(_("Assujetti à la tva"), 'style="text-align:right"') . $tva_use->input("p_tva_use", $strict_array) . "</tr>";
echo "<tr>" . td(_("Suggérer le numéro de pièce justificative"), 'style="text-align:right"') . $pj_suggest->input("p_pj", $strict_array) . "</tr>";
echo "<tr>" . td(_("Suggérer la date"), 'style="text-align:right"') . $date_suggest->input("p_date_suggest", $strict_array) . "</tr>";
echo '<tr>' . td(_('Afficher la période comptable pour éviter les erreurs de date'), 'style="text-align:right"') . $check_periode->input('p_check_periode', $strict_array) . '</tr>';
echo '<tr>' . td(_('Utilisez des postes comptables alphanumérique'), 'style="text-align:right"') . $alpha_num->input('p_alphanum') . '</tr>';
echo '<tr>' . td(_('Changer le libellé des détails'), 'style="text-align:right"') . $updlab->input('p_updlab') . '</tr>';
echo '<tr>' .
td(_("Poste comptable de CHARGE (D) pour les différences d'arrondi pour les opérations en devise")).
'<td>'.$default_error_deb->input().
'</td>'.
'</tr>';
echo '<tr>' .
td(_("Poste comptable en PRODUIT (C) pour les différences d'arrondi pour les opérations en devise")).
'<td>'.$default_error_cred->input().
'</td>'.
'</tr>';
echo "</table>";
echo HtmlInput::submit("record_company", _("Sauve"));
echo "</form>";
echo '</div>';
return;
?>