Merge branch 'unstable' into pre-stable

* unstable: (149 commits)
  Update DB Test for PHPUNIT
  Update DB Test for PHPUNIT
  Documentation  Code Doxygen
  Fix 2398 : bug si melange de montants  négatifs et positifs avec de la TVA en autoliquidation
  Esthetic
  VAT ND Analytic : fix bug
  Code improve Todo List to finish , allow a empty date
  Documentation
  Operation Analytic : save_form_plan_vat_nd , check that the total is the same as the VAT ND amount
  improve Operation detail : show Analytic imputation for VAT Not Deductible
  Documentation
  Operation Analytic : save_form_plan_vat_nd , check that the total is the same as the VAT ND amount
  improve Operation detail : show Analytic imputation for VAT Not Deductible
  improve doc
  improve doc
  New : label cannot be empty
  New : label cannot be empty
  FIX P0TVA when no data
  FIX P0TVA when no data
  FIX : javascript id$ function
  ...
This commit is contained in:
sparkyx 2024-12-21 19:51:39 +01:00
commit 88276dd81e
165 changed files with 3267 additions and 2026 deletions

View file

@ -25,16 +25,18 @@ BODY {
color:darkblue !important;
background-color:#FCFDFD;
--hover : rgba(108, 130, 208, 0.9);
--border-size:4px;
--border-size:8px;
--accent-color:lightblue;
--input-color:#4b4b91;
--color-red:Crimson;
}
input{
font-family: 'OpenSansRegular';
padding : 2px;
margin:2px;
border:1px solid #4b4b91;
font-size:14px;
color:#4b4b91;
border:1px solid var(--input-color);
color:var(--input-color);
}
input:focus {
@ -112,16 +114,16 @@ h2 {
background-color:#9fbcd6;
/*! margin:1px; */
font-style: italic;
font-size:15px;
font-size:1.1rem !important;
margin-top: 5px;
font-size: 1.1rem;
margin-bottom: 1rem;
margin-top: 1rem;
margin-right:1rem;
margin-left:1rem;
border-radius: 10px 0px;
padding:1rem;
font-size: 1.20rem;
margin-bottom: 1rem;
margin-top: 1rem;
margin-right:1rem;
margin-left:1rem;
border-radius: 10px;
padding:1rem;
}
@media only screen and (max-width: 1280px) {
h2{
@ -261,6 +263,43 @@ td.tool a.mtitle:hover {
transition:color 300ms ease-in-out;
}
#module .nav-pills a.nav-link:hover {
color:white !important;
border:1px solid transparent;
}
#module .nav-item-active , #module .nav-item-active > a.nav-link{
background-color: #5d90cd ;
color:white !important;
border: 0px solid black;
}
/* animate module : sliding */
#module .nav-item-module {
position:relative;
background-color: white;
color:navy;
}
#module .nav-item-module.nav-item-slide::before {
content:'';
top:0;
left:0;
bottom:0;
right:0;
position:absolute;
background-color:#5d90cd;
z-index:-1;
transform:scaleX(0);
transition:transform 300ms ease-in-out;
mix-blend-mode: darken;
}
#module .nav-item-module.nav-item-slide:hover::before,
#module .nav-item-module.nav-item-slide:focus::before {
transform:scaleX(1);
}
#module .nav-item-slide {
z-index:0;
transition:color 300ms ease-in-out;
}
@ -280,6 +319,7 @@ td.tool a.mtitle:hover {
/**
menu left (not used)
*/
div.lmenu {
float:left;
clear:left;
@ -301,7 +341,7 @@ div.content{
width:99.7%;
font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif;
font-family: 'OpenSansRegular';
font-size:12px;
font-size:100%;
font-size:1rem;
}
@ -471,7 +511,7 @@ tr.odd > td,tr.even > td {
}
.highlight {
font-weight: bolder;
font-size:14px;
font-size:105%;
font-size:1.05rem;
}
tr.highlight {
@ -671,7 +711,7 @@ a.document:hover {
margin:1px;
}
.input_text {
border:1px solid #4b4b91;
border:1px solid var(--input-color);
margin:1px;
border-radius: 5px;
}
@ -698,7 +738,7 @@ a.document:hover {
h1.legend, legend {
font-weight: bold;
font-style: italic;
font-size: 19.2px;
font-size: 120%;
font-size: 1.2rem;
border: navy;
border-width: 1px;
@ -968,7 +1008,7 @@ a#smallanchorbutton, .smallbutton, a.smallbutton,div.content a.smallbutton {
font-weight: normal;
text-decoration:none;
font-family: arial,verdana,sans-serif,helvetica;
font-size:12px;
font-size:85%;
font-size:0.85rem;
font-family: SansationLight;
border-style: ridge ;
@ -1050,7 +1090,7 @@ td.toolselected a.mtitle {
background-color:#FF0000;
}
div.topmenu {
font-size:13.6px;
font-size:100%;
font-size:1rem;
}
@ -1135,7 +1175,7 @@ div.inner_box {
border:1px solid #00008B;
-moz-box-shadow: 10px 10px 5px #888;
box-shadow: 15px 15px 15px #888;
font-size:14.4px;
font-size:90%;
font-size:0.9rem;
width: 100%;
left:0px ;
@ -1154,7 +1194,7 @@ div.inner_box {
border:1px solid #00008B;
-moz-box-shadow: 10px 10px 5px #888;
box-shadow: 15px 15px 15px #888;
font-size:14.4px;
font-size:90%;
font-size:0.9rem;
width: 50%;
left:22% ;
@ -1496,7 +1536,7 @@ div.content a.nav:hover img,a.nav:hover img {
}
div.foldercontent {
font-size:14px;
font-size:95%;
font-size:0.95rem;
width: 95%;
margin-left: 2.5%;
@ -1522,7 +1562,7 @@ div.foldercontent {
}
div.foldercontent {
font-size:14px;
font-size:95%;
font-size:0.95rem;
width: 95%;
margin-left: 2.5%;
@ -1603,7 +1643,7 @@ div.myfieldset
border-style: groove;
}
div.menu2 a.mtitle{
font-size:13.6px;
font-size:100%;
font-size:1rem;
font-weight: normal;
/*color: darkblue;*/
@ -1629,7 +1669,7 @@ div.menu2 table {
/*! border-spacing:1px; */
}
div.menu3 {
font-size:13.6px;
font-size:80%;
font-size:0.80rem;
}
@ -1640,7 +1680,7 @@ div.menu3 {
margin-left:30px;
}
#folder {
border: 1px solid #4b4b91;
border: 1px solid var(--input-color);
border-collapse: separate;
border-radius: 10px;
border-spacing: 0px;
@ -1887,7 +1927,7 @@ left:25%;
/**========*/
#error_div h2 {
background: #FF0000;
background: var(--color-red);
}
div#error_content_div {
color:#FF0000;
@ -1902,7 +1942,7 @@ td.workday ol {
}
input.inum {
text-align:right;
border:1px solid #4b4b91;
border:1px solid var(--input-color);
margin:2px;
border-radius: 5px;
}
@ -1912,7 +1952,7 @@ div.box {
font-family: 'openSansRegular';
overflow:hidden;
border:1px solid #00008B;
font-size:10px;
font-size:90%;
font-size:0.90rem;
border-radius:5px;
width:97%;
@ -1962,7 +2002,7 @@ div.even ,div.box tr.even {
padding:2px;
}
#jrn_name_div h2{
font-size:38.4px;
font-size:240%;
font-size: 2.4rem;
}
#search_account {
@ -2187,7 +2227,7 @@ hr {
******************************************************************************/
li.highlight,tr.highlight{
font-weight: bolder;
font-size:14px;
font-size:90%;
background-color: #8A8787;
color:whitesmoke !important;
border-width: 2px;
@ -2256,7 +2296,7 @@ div.content a.tinybutton,a.tinybutton{
/* background-image: url("font/bg-submit2.gif");
background-repeat: repeat-x;
background-position: left; */
font-size: 8px;
font-size: 70%;
font-size: 0.7rem;
padding-bottom: 0px;
padding-top: 0px;
@ -2279,7 +2319,7 @@ input[type="button"].tinybutton {
font-weight: bold;
text-decoration: none;
font-family: arial,verdana,sans-serif,helvetica;
font-size: 8px;
font-size: 70%;
font-size: 0.7rem;
padding-bottom: 0px;
padding-top: 0px;
@ -2472,7 +2512,7 @@ width: 85%;
/*! background-image: url("font/bg-submit2.gif"); */
/*! background-repeat: repeat-x; */
/*! background-position: left; */
font-size:12px;
font-size:85%;
font-size:0.85rem;
font-family: SansationLight;
border-style: ridge ;
@ -2508,7 +2548,8 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', end
width: 75%;
display: inline-block;
background-color: white;
font-size: 16px;
font-size: 100%;
font-size: 1rem;
padding: 8px;
}
@ -2758,7 +2799,7 @@ div.bxbutton .icon
margin-left: 6px;
margin-right:6px;
/*! padding-top:10px; */
font-size:14px;
font-size:100%;
font-size:1rem;
cursor: pointer;
border:0px;
@ -3283,10 +3324,10 @@ margin:1px;
margin: 1px;
background: navy;
color: white;
border-radius: 3px;
border-radius: 4px;
}
.nav-fill .nav-item:hover {
background-color:#6393c1;
background-color:#6393c1;
color:navy;
text-decoration: none;
}
@ -3301,9 +3342,39 @@ margin:1px;
color:white ;
}
li.li-active {
background-color: lightgray !important;
/****************************************/
/* MENU LEVEL 0 */
/****************************************/
.nav-level0 {
}
/* SM */
@media (min-width: 576px) {
}
/* MD */
@media (min-width: 768px) {
.nav-level0 > li >a {
padding:6%;
}
}
/* LG */
@media (min-width: 992px) {
}
/* XL */
@media (min-width: 1200px) {
}
/****************************************/
/* MENU LEVEL2 */
/****************************************/
.nav-level2 {
background-color: hsl(240, 39%, 41.2%);
}
@ -3316,10 +3387,21 @@ li.li-active {
color:navy;
text-decoration: none;
}
/* MD */
@media (min-width: 768px) {
.nav-level2 .nav-item {
padding : 0%;
}
}
/****************************************/
/* MENU LEVEL 3 */
/***************************************/
.nav-level3 {
background-color:#336699;
}
.nav-level3>li {
border-right: 1px #9fbcd6 ridge;
@ -3337,9 +3419,9 @@ li.li-active {
border-radius:0px !important;
}
/**
* Module for smartphone menu
*/
/****************************************/
/* Module for smartphone menu */
/***************************************/
#mobile_module .nav-pills a.nav-link {
background-color:transparent !important;
color:navy !important;
@ -3722,7 +3804,7 @@ h2.h-section {
height:var(--border-size);
background-color:lightblue;
transform:scaleX(0);
transition:transform 300ms ease-in-out;
transition:transform 150ms ease-in-out;
}
.nav-item.nav-item-underline:hover::before,
@ -3733,7 +3815,7 @@ h2.h-section {
.nav-item.li-active.nav-item-underline::before {
transform: scale(1);
background-color: darkred;
background-color: #d03100;
}
/**
@ -3747,9 +3829,58 @@ h2.h-section {
left: 0;
right: 0;
background-color:darkorange;
height: 3px;
height: var(--border-size);
}
.nav-level3 .nav-link.active::after {
background-color:yellow;
}
}
/***
* Animate menu
*
*/
.nav-item {
position:relative;
}
.nav-item.nav-item-underline::before {
content:'';
left:0;
bottom:0;
right:0;
position:absolute;
height:var(--border-size);
background-color:lightblue;
transform:scaleX(0);
transition:transform 300ms ease-in-out;
}
.nav-item.nav-item-underline:hover::before,
.nav-item.nav-item-underline:focus::before
{
transform:scaleX(1);
}
.nav-item.li-active.nav-item-underline::before {
transform: scale(1);
background-color: var(--color-red);
}
/**
* For level 2 and 3 no animation but border difference if active
*/
.nav-level2 .nav-link.active::after, .nav-level3 .nav-link.active::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color:darkorange;
}
.nav-level3 .nav-link.active::after {
background-color:yellow;
}

View file

@ -53,6 +53,27 @@ if ( $action=='X' || $g_user->check_print($action)==0 )
// get file and execute it
$prfile=$cn->get_value("select me_file from menu_ref where me_code=$1",array($action));
if ( LOGINPUT)
{
$file_loginput=fopen($_ENV['TMP'].'/export-'.$prfile.'-'.$_SERVER['REQUEST_TIME'].'.php','a+');
fwrite ($file_loginput,"<?php \n");
fwrite ($file_loginput,'//@description: export '.$prfile."\n");
fwrite($file_loginput, '$_GET='.var_export($_GET,true));
fwrite($file_loginput,";\n");
fwrite($file_loginput, '$_POST='.var_export($_POST,true));
fwrite($file_loginput,";\n");
fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
fwrite($file_loginput,"\n");
fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
fwrite($file_loginput,"\n");
fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
fwrite($file_loginput,"\n");
fwrite($file_loginput,' require_once NOALYSS_INCLUDE."/export/'.$prfile.'";');
fwrite($file_loginput,"\n");
fclose($file_loginput);
}
if ( $prfile == "" || !file_exists(NOALYSS_INCLUDE."/export/$prfile")) {
print $action;
die (_('Export impossible'));

View file

@ -56,8 +56,28 @@ if ( $ext->search($http->request("plugin_code")) != -1 )
{
exit();
}
if ( LOGINPUT)
{
$file_loginput=fopen($_ENV['TMP'].'/plugin-export-'.$ext->me_code.'-'.$_SERVER['REQUEST_TIME'].'.php','a+');
fwrite ($file_loginput,"<?php \n");
fwrite ($file_loginput,'//@description: export '.$ext->me_code."\n");
fwrite($file_loginput, '$_GET='.var_export($_GET,true));
fwrite($file_loginput,";\n");
fwrite($file_loginput, '$_POST='.var_export($_POST,true));
fwrite($file_loginput,";\n");
fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
fwrite($file_loginput,"\n");
fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
fwrite($file_loginput,"\n");
fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
fwrite($file_loginput,"\n");
$string='require_once "'.NOALYSS_PLUGIN.DIRECTORY_SEPARATOR.dirname(trim($ext->getp('me_file'))).DIRECTORY_SEPARATOR.'raw.php'.'";';
fwrite($file_loginput,sprintf("%s",$string));
fwrite($file_loginput,"\n");
fclose($file_loginput);
}
/* call the ajax script */
require_once(NOALYSS_PLUGIN.DIRECTORY_SEPARATOR.dirname(trim($ext->getp('me_file'))).DIRECTORY_SEPARATOR.'raw.php');
require_once NOALYSS_PLUGIN.DIRECTORY_SEPARATOR.dirname(trim($ext->getp('me_file'))).DIRECTORY_SEPARATOR.'raw.php';
}
else
{

View file

@ -45,7 +45,7 @@ function CurrencyRateDelete(p_dossier, p_id)
if ( answer['status'] == 'NOK') {
smoke.alert(answer['content']);
} else {
$('currency_rate_'+p_id).hide();
id$('currency_rate_'+p_id).hide();
alternate_row_color("currency_rate_table");
}
}
@ -64,11 +64,11 @@ function CurrencyUpdateValue(p_dossier,p_code,p_update)
new Ajax.Request("ajax_misc.php",{
method:"get",
asynchronous:false,
parameters:{p_code:$(p_code).value,gDossier:p_dossier,op:'CurrencyRate'},
parameters:{p_code:id$(p_code).value,gDossier:p_dossier,op:'CurrencyRate'},
onSuccess:function (req) {
var answer=req.responseText.evalJSON();
if ( answer.status == "OK") {
$(p_update).value=answer.content;
id$(p_update).value=answer.content;
} else {
smoke.alert(answer.content);
}
@ -84,11 +84,11 @@ function CurrencyUpdateCode(p_dossier,p_code,p_update)
{
new Ajax.Request("ajax_misc.php",{
method:"get",
parameters:{p_code:$(p_code).value,gDossier:p_dossier,op:'CurrencyCode'},
parameters:{p_code:id$(p_code).value,gDossier:p_dossier,op:'CurrencyCode'},
onSuccess:function (req) {
var answer=req.responseText.evalJSON();
if ( answer.status == "OK") {
$(p_update).innerHTML=answer.content;
id$(p_update).innerHTML=answer.content;
} else {
smoke.alert(answer.content);
}
@ -104,22 +104,22 @@ function CurrencyCompute(p_rate,p_update)
{
var tvac=1;
if ($('tvac')) {
tvac=$('tvac').innerHTML;
} else if ($("htva")) {
tvac=$('htva').innerHTML;
if (document.getElementById('tvac')) {
tvac=id$('tvac').innerHTML;
} else if (document.getElementById("htva")) {
tvac=id$('htva').innerHTML;
}
if ( isNaN(tvac)) {
tvac=1;
}
var rate=$(p_rate).value;
var rate=id$(p_rate).value;
if ( isNaN(rate)) {
rate=1;
}
var tot=tvac/rate;
tot=Math.round(tot*100)/100;
$(p_update).innerHTML=tot;
id$(p_update).innerHTML=tot;
}
/**
@ -131,8 +131,8 @@ function CurrencyCompute(p_rate,p_update)
*/
function CurrencyComputeMisc(p_rate,p_update)
{
var debAmount=$('totalDeb').innerHTML;
var credAmount=$('totalCred').innerHTML;
var debAmount=id$('totalDeb').innerHTML;
var credAmount=id$('totalCred').innerHTML;
if ( isNaN(debAmount)) {
debAmount=0;
@ -140,17 +140,17 @@ function CurrencyComputeMisc(p_rate,p_update)
if ( isNaN(credAmount)) {
credAmount=0;
}
var rate=$(p_rate).value;
var rate=id$(p_rate).value;
if ( isNaN(rate) || parseFloat(rate) == 0) {
rate=1;
}
var totDeb=debAmount/rate;
totDeb=Math.round(totDeb*100)/100;
$('default_currency_deb').innerHTML=totDeb;
id$('default_currency_deb').innerHTML=totDeb;
var totCred=credAmount/rate;
totCred=Math.round(totCred*100)/100;
$('default_currency_cred').innerHTML=totCred;
id$('default_currency_cred').innerHTML=totCred;
}
@ -166,10 +166,10 @@ function CurrencyComputeMisc(p_rate,p_update)
function LedgerCurrencyUpdate(p_dossier,p_code,p_update,p_rate,p_eur_amount)
{
// Hide or show the row of the table with the amount in EUR
if ($(p_code).value != 0) {
$('row_currency').show();
if (document.getElementById(p_code).value != 0) {
id$('row_currency').show();
}else {
$('row_currency').hide();
id$('row_currency').hide();
}
CurrencyUpdateValue(p_dossier,p_code,p_rate);
CurrencyUpdateCode(p_dossier,p_code,p_update);
@ -189,10 +189,10 @@ function LedgerCurrencyUpdate(p_dossier,p_code,p_update,p_rate,p_eur_amount)
function LedgerCurrencyUpdateMisc(p_dossier,p_code,p_update,p_rate,p_eur_amount)
{
// Hide or show the row of the table with the amount in EUR (= default currency)
if ($(p_code).value != -1) {
$('row_currency').show();
if (document.getElementById(p_code).value != -1) {
id$('row_currency').show();
}else {
$('row_currency').hide();
id$('row_currency').hide();
}
CurrencyUpdateValue(p_dossier,p_code,p_rate);
CurrencyUpdateCode(p_dossier,p_code,p_update);

View file

@ -32,10 +32,10 @@ var layer = 1;
* \brief update the list of available predefined operation when we change the ledger.
*/
function update_predef(p_type, p_direct, p_ac) {
var jrn = g("p_jrn").value;
var dossier = g("gDossier").value;
var jrn = id$("p_jrn").value;
var dossier = id$("gDossier").value;
var querystring = 'gDossier=' + dossier + '&l=' + jrn + '&t=' + p_type + '&d=' + p_direct + "&op=up_predef&ac=" + p_ac;
g("p_jrn_predef").value = jrn;
id$("p_jrn_predef").value = jrn;
var action = new Ajax.Request(
"ajax_misc.php",
{
@ -44,7 +44,7 @@ function update_predef(p_type, p_direct, p_ac) {
onFailure: error_get_predef,
onSuccess: function (req) {
try {
$('info_div').innerHTML = "ok";
id$('info_div').innerHTML = "ok";
var answer = req.responseXML;
var a = answer.getElementsByTagName('code');
var html = answer.getElementsByTagName('value');
@ -55,9 +55,9 @@ function update_predef(p_type, p_direct, p_ac) {
var code_html = getNodeText(html[0]);
code_html = unescape_xml(code_html);
// document.getElementsByName(name_ctl)[0].value = code_html;
$('modele_op_div').innerHTML = code_html;
id$('modele_op_div').innerHTML = code_html;
} catch (e) {
$('info_div').innerHTML = e.message;
id$('info_div').innerHTML = e.message;
}
}
}
@ -69,8 +69,8 @@ function update_predef(p_type, p_direct, p_ac) {
*/
function update_pay_method() {
waiting_box();
var jrn = g("p_jrn").value;
var dossier = g("gDossier").value;
var jrn = id$("p_jrn").value;
var dossier = id$("gDossier").value;
var querystring = 'gDossier=' + dossier + '&l=' + jrn + "&op=up_pay_method";
var action = new Ajax.Request(
"ajax_misc.php",
@ -81,7 +81,7 @@ function update_pay_method() {
onSuccess: function (req) {
remove_waiting_box();
var answer = req.responseText;
$('payment').innerHTML = answer;
id$('payment').innerHTML = answer;
}
}
);
@ -92,8 +92,8 @@ function update_pay_method() {
*/
function update_other_tax() {
waiting_box();
var jrn = g("p_jrn").value;
var dossier = g("gDossier").value;
var jrn = id$("p_jrn").value;
var dossier = id$("gDossier").value;
var querystring = {gDossier: dossier, jrn_id: jrn, op: "up_other_tax"};
var action = new Ajax.Request(
"ajax_misc.php",
@ -105,7 +105,7 @@ function update_other_tax() {
remove_waiting_box();
var answer = req.responseText;
answer.evalScripts();
$('additional_tax_div').innerHTML = answer;
id$('additional_tax_div').innerHTML = answer;
}
}
);
@ -115,8 +115,8 @@ function update_other_tax() {
* update ctl id =jrn_name with the value of p_jrn
*/
function update_name() {
var jrn_id = $('p_jrn').value;
var dossier = g("gDossier").value;
var jrn_id = id$('p_jrn').value;
var dossier = id$("gDossier").value;
var querystring = 'gDossier=' + dossier + '&l=' + jrn_id + "&op=ledger_description";
var action = new Ajax.Request(
"ajax_misc.php",
@ -125,7 +125,7 @@ function update_name() {
parameters: querystring,
onFailure: error_get_pj,
onSuccess: function (req) {
$('jrn_name_div').innerHTML = req.responseText;
id$('jrn_name_div').innerHTML = req.responseText;
}
}
);
@ -143,9 +143,9 @@ function error_get_predef(request, json) {
/**
* update the list of available predefined operation when we change the ledger.
*/
function update_pj() {
var jrn = g("p_jrn").value;
var dossier = g("gDossier").value;
function update_receipt() {
var jrn = id$("p_jrn").value;
var dossier = id$("gDossier").value;
var querystring = 'gDossier=' + dossier + '&l=' + jrn + "&op=upd_receipt";
var action = new Ajax.Request(
"ajax_misc.php",
@ -162,8 +162,8 @@ function update_pj() {
* ask the name, quick_code of the bank for the ledger
*/
function update_bank() {
var jrn = g('p_jrn').value;
var dossier = g('gDossier').value;
var jrn = id$('p_jrn').value;
var dossier = id$('gDossier').value;
var qs = 'gDossier=' + dossier + '&op=bkname&p_jrn=' + jrn;
var action = new Ajax.Request(
"ajax_misc.php",
@ -186,10 +186,10 @@ function update_row(ctl) {
if (ctl === 'quick_item') {
row_to_keep = 1;
} /* for ODS , only 1 rows to keep */
var jrn = g('p_jrn').value;
var dossier = g('gDossier').value;
var jrn = id$('p_jrn').value;
var dossier = id$('gDossier').value;
var qs = encodeURI('gDossier=' + dossier + '&op=minrow&j=' + jrn + '&ctl=' + ctl);
var current_row = parseFloat($('nb_item').value);
var current_row = parseFloat(id$('nb_item').value);
var action = new Ajax.Request(
"ajax_misc.php",
{
@ -201,11 +201,11 @@ function update_row(ctl) {
var answer = request.responseText.evalJSON(true);
var row = parseFloat(answer.row);
var table_to_update = $(ctl);
var table_to_update = id$(ctl);
if (current_row > row) {
// Too many row, we always must keep 2 rows for the sum
var delta = $('nb_item').value - row;
var idx = $('nb_item').value;
var delta = id$('nb_item').value - row;
var idx = id$('nb_item').value;
for (var i = 0; i < delta; i++) {
var pos_row = table_to_update.rows.length;
var cell0 = table_to_update.rows[pos_row - row_to_keep].cells[0];
@ -239,7 +239,7 @@ function update_row(ctl) {
}
}
$('nb_item').value = table_to_update.rows.length - row_to_keep;
id$('nb_item').value = table_to_update.rows.length - row_to_keep;
}
if (current_row < row) {
// We need to add rows
@ -271,8 +271,8 @@ function update_row(ctl) {
* @brief hide or show the column quantity
*/
function update_visibility_quantity() {
var jrn = g("p_jrn").value;
var dossier = g("gDossier").value;
var jrn = id$("p_jrn").value;
var dossier = id$("gDossier").value;
var querystring = 'gDossier=' + dossier + '&l=' + jrn + "&op=update_visibility_quantity";
var action = new Ajax.Request(
"ajax_misc.php",
@ -321,7 +321,7 @@ function success_update_bank(req) {
var name_ctl = a[0].firstChild.nodeValue;
var code_html = getNodeText(html[0]);
code_html = unescape_xml(code_html);
$(name_ctl).innerHTML = code_html;
id$(name_ctl).innerHTML = code_html;
} catch (e) {
alert_box("success_update_bank" + e.message);
}
@ -331,8 +331,8 @@ function success_update_bank(req) {
* call ajax, ask what is the last date for the current ledger
*/
function get_last_date() {
var jrn = g('p_jrn').value;
var dossier = g('gDossier').value;
var jrn = id$('p_jrn').value;
var dossier = id$('gDossier').value;
var qs = 'gDossier=' + dossier + '&op=lastdate&p_jrn=' + jrn;
var action = new Ajax.Request(
"ajax_misc.php",
@ -372,12 +372,12 @@ function success_get_last_date(req) {
function success_get_pj(request, json) {
var answer = request.responseText.evalJSON(true);
var obj = g("e_pj");
var obj = id$("e_pj");
obj.value = '';
if (answer.length == 0)
return;
obj.value = answer.pj;
g("e_pj_suggest").value = answer.pj;
id$("e_pj_suggest").value = answer.pj;
}
/**
@ -392,10 +392,10 @@ function error_get_pj(request, json) {
*/
function ledger_fin_add_row() {
var style = 'class="input_text"';
var mytable = g("fin_item").tBodies[0];
var mytable = id$("fin_item").tBodies[0];
var line = mytable.rows.length;
var row = mytable.insertRow(line);
var nb = g("nb_item");
var nb = id$("nb_item");
var rowToCopy = mytable.rows[1];
var nNumberCell = rowToCopy.cells.length;
for (var e = 0; e < nNumberCell; e++) {
@ -415,15 +415,15 @@ function ledger_fin_add_row() {
newCell.className = rowToCopy.cells[e].className;
new_tt.evalScripts();
}
g("e_other" + nb.value).value = "";
g("e_other_name" + nb.value).value = "";
g("e_other" + nb.value + '_amount').value = "0";
g("e_other" + nb.value + '_comment').value = "";
g("e_concerned" + nb.value).value = "";
id$("e_other" + nb.value).value = "";
id$("e_other_name" + nb.value).value = "";
id$("e_other" + nb.value + '_amount').value = "0";
id$("e_other" + nb.value + '_comment').value = "";
id$("e_concerned" + nb.value).value = "";
var ch = $('chdate').options[$('chdate').selectedIndex].value;
var ch = id$('chdate').options[id$('chdate').selectedIndex].value;
if (ch == 1) {
$('tdchdate' + nb.value).hide();
id$('tdchdate' + nb.value).hide();
}
nb.value++;
}
@ -433,11 +433,11 @@ function ledger_fin_add_row() {
* @param string p_elid is the id of element with the number of rows to add, and p_elid+"_ledger" is the type of ledger : M : Misc Operation O : Sales or purchase and F for financial
*/
function ledger_add_multiple(p_elid) {
var nbrow = $(p_elid).value;
var nbrow = id$(p_elid).value;
if (nbrow == NaN) {
nbrow = 1;
}
var type_ledger = $(p_elid + "_ledger").value;
var type_ledger = id$(p_elid + "_ledger").value;
var i = 0;
for (i = 0; i < nbrow; i++) {
if (type_ledger == 'O') {
@ -464,12 +464,12 @@ function ledger_add_multiple(p_elid) {
function ledger_add_row() {
try {
style = 'class="input_text"';
var mytable = g("sold_item").tBodies[0];
var mytable = id$("sold_item").tBodies[0];
var ofirstRow = mytable.rows[1];
var line = mytable.rows.length;
var nCell = mytable.rows[1].cells.length;
var row = mytable.insertRow(line);
var nb = g("nb_item");
var nb = id$("nb_item");
for (var e = 0; e < nCell; e++) {
var newCell = row.insertCell(e);
var tt = ofirstRow.cells[e].innerHTML;
@ -483,13 +483,13 @@ function ledger_add_row() {
new_tt.evalScripts();
}
$("e_march" + nb.value + "_label").innerHTML = '';
$("e_march" + nb.value + "_label").value = '';
$("e_march" + nb.value + "_price").value = '0';
$("e_march" + nb.value).value = "";
$("e_quant" + nb.value).value = "1";
if ($("e_march" + nb.value + "_tva_amount"))
$("e_march" + nb.value + "_tva_amount").value = 0;
id$("e_march" + nb.value + "_label").innerHTML = '';
id$("e_march" + nb.value + "_label").value = '';
id$("e_march" + nb.value + "_price").value = '0';
id$("e_march" + nb.value).value = "";
id$("e_quant" + nb.value).value = "1";
if (document.getElementById("e_march" + nb.value + "_tva_amount"))
id$("e_march" + nb.value + "_tva_amount").value = 0;
nb.value++;
@ -505,17 +505,17 @@ function ledger_add_row() {
* @param the number of the changed ctrl
*/
function compute_ledger(p_ctl_nb) {
var dossier = g("gDossier").value;
var dossier = id$("gDossier").value;
var a = -1;
if (document.getElementById("e_march" + p_ctl_nb + '_tva_amount')) {
a = trim(g("e_march" + p_ctl_nb + '_tva_amount').value);
g("e_march" + p_ctl_nb + '_tva_amount').value = a;
a = trim(id$("e_march" + p_ctl_nb + '_tva_amount').value);
id$("e_march" + p_ctl_nb + '_tva_amount').value = a;
}
if (!document.getElementById("e_march" + p_ctl_nb)) {
return;
}
g("e_march" + p_ctl_nb).value = trim(g("e_march" + p_ctl_nb).value);
var qcode = g("e_march" + p_ctl_nb).value;
id$("e_march" + p_ctl_nb).value = trim(id$("e_march" + p_ctl_nb).value);
var qcode = id$("e_march" + p_ctl_nb).value;
if (qcode.length == 0) {
clean_ledger(p_ctl_nb);
@ -526,19 +526,19 @@ function compute_ledger(p_ctl_nb) {
* if tva_id is empty send a value of -1
*/
var tva_id = -1;
if (g('e_march' + p_ctl_nb + '_tva_id')) {
tva_id = g('e_march' + p_ctl_nb + '_tva_id').value;
if (document.getElementById('e_march' + p_ctl_nb + '_tva_id')) {
tva_id = id$('e_march' + p_ctl_nb + '_tva_id').value;
if (trim(tva_id) == '') {
tva_id = -1;
}
}
g('e_march' + p_ctl_nb + '_price').value = trim(g('e_march' + p_ctl_nb + '_price').value);
var price = g('e_march' + p_ctl_nb + '_price').value;
id$('e_march' + p_ctl_nb + '_price').value = trim(id$('e_march' + p_ctl_nb + '_price').value);
var price = id$('e_march' + p_ctl_nb + '_price').value;
g('e_quant' + p_ctl_nb).value = trim(g('e_quant' + p_ctl_nb).value);
var quantity = g('e_quant' + p_ctl_nb).value;
let other_tax = g("other_tax");
id$('e_quant' + p_ctl_nb).value = trim(id$('e_quant' + p_ctl_nb).value);
var quantity = id$('e_quant' + p_ctl_nb).value;
let other_tax = document.getElementById("other_tax");
let other_tax_id = (other_tax && other_tax.checked) ? other_tax.value : -1;
var querystring = {
@ -569,26 +569,26 @@ function refresh_ledger() {
var htva = 0;
var tvac = 0;
nb_item = g("nb_item").value;
nb_item = id$("nb_item").value;
for (var i = 0; i < nb_item; i++) {
if (g('tva_march' + i))
tva += g('tva_march' + i).value * 1;
if (g('htva_march' + i))
htva += g('htva_march' + i).value * 1;
if (g('tvac_march' + i))
tvac += g('tvac_march' + i).value * 1;
if (document.getElementById('tva_march' + i))
tva += id$('tva_march' + i).value * 1;
if (document.getElementById('htva_march' + i))
htva += id$('htva_march' + i).value * 1;
if (document.getElementById('tvac_march' + i))
tvac += id$('tvac_march' + i).value * 1;
}
id_tva = g("tva");
id_htva = g("htva");
id_tvac = g("tvac");
id_other_tax = g("other_tax_amount");
id_tva = id$("tva");
id_htva = id$("htva");
id_tvac = id$("tvac");
id_other_tax = document.getElementById("other_tax_amount");
if (id_tva)
id_tva.innerHTML = Math.round(tva * 100) / 100;
if (id_htva)
id_htva.innerHTML = Math.round(htva * 100) / 100;
if (id_other_tax) {
let total_operation = tvac + parseFloat(id_other_tax.value);
$('total_operation_other_tax').innerHTML = Math.round(total_operation * 100) / 100;
id$('total_operation_other_tax').innerHTML = Math.round(total_operation * 100) / 100;
}
if (id_tvac)
id_tvac.innerHTML = Math.round(tvac * 100) / 100;
@ -607,15 +607,15 @@ function success_compute_ledger(request, json) {
var rtva = answer.tva;
var rhtva = answer.htva;
var rtvac = answer.tvac;
let other_tax = g("other_tax_amount")
let other_tax = id$("other_tax_amount")
if (other_tax) {
other_tax.value = answer.other_tax;
}
if (rtva == 'NA') {
var rhtva = answer.htva * 1;
g('htva_march' + ctl).value = rhtva;
g('tvac_march' + ctl).value = rtvac;
g('sum').show();
id$('htva_march' + ctl).value = rhtva;
id$('tvac_march' + ctl).value = rtvac;
id$('sum').show();
refresh_ledger();
CurrencyCompute('p_currency_rate', 'p_currency_euro');
@ -624,17 +624,18 @@ function success_compute_ledger(request, json) {
rtva = answer.tva * 1;
g('sum').show();
if (g('e_march' + ctl + '_tva_amount').value == "" || g('e_march' + ctl + '_tva_amount').value == 0) {
g('tva_march' + ctl).value = rtva;
g('e_march' + ctl + '_tva_amount').value = rtva;
id$('sum').show();
if (document.getElementById('e_march' + ctl + '_tva_amount').value == "" ||
document.getElementById('e_march' + ctl + '_tva_amount').value == 0) {
id$('tva_march' + ctl).value = rtva;
id$('e_march' + ctl + '_tva_amount').value = rtva;
} else {
g('tva_march' + ctl).value = g('e_march' + ctl + '_tva_amount').value;
id$('tva_march' + ctl).value = id$('e_march' + ctl + '_tva_amount').value;
}
g('htva_march' + ctl).value = Math.round(parseFloat(rhtva) * 100) / 100;
var tmp1 = Math.round(parseFloat(g('htva_march' + ctl).value) * 100) / 100;
var tmp2 = Math.round(parseFloat(g('tva_march' + ctl).value) * 100) / 100;
g('tvac_march' + ctl).value = Math.round((tmp1 + tmp2) * 100) / 100;
id$('htva_march' + ctl).value = Math.round(parseFloat(rhtva) * 100) / 100;
var tmp1 = Math.round(parseFloat(id$('htva_march' + ctl).value) * 100) / 100;
var tmp2 = Math.round(parseFloat(id$('tva_march' + ctl).value) * 100) / 100;
id$('tvac_march' + ctl).value = Math.round((tmp1 + tmp2) * 100) / 100;
refresh_ledger();
CurrencyCompute('p_currency_rate', 'p_currency_euro');
@ -649,7 +650,7 @@ function error_compute_ledger(request, json) {
function compute_all_ledger() {
var loop = 0;
let nb_item = g("nb_item").value;
let nb_item = id$("nb_item").value;
for (loop = 0; loop < nb_item; loop++) {
compute_ledger(loop);
}
@ -658,53 +659,52 @@ function compute_all_ledger() {
var tvac = 0;
for (var i = 0; i < nb_item; i++) {
if (g('tva_march'))
tva += g('tva_march' + i).value * 1;
if (g('htva_march' + i))
htva += g('htva_march' + i).value * 1;
if (g('tvac_march' + i))
tvac += g('tvac_march' + i).value * 1;
if (document.getElementById('tva_march'))
tva += id$('tva_march' + i).value * 1;
if (document.getElementById('htva_march' + i))
htva += id$('htva_march' + i).value * 1;
if (document.getElementById('tvac_march' + i))
tvac += id$('tvac_march' + i).value * 1;
}
id_other_tax = g("other_tax_amount");
if (g('tva'))
g('tva').innerHTML = Math.round(tva * 100) / 100;
if (g('htva'))
g('htva').innerHTML = Math.round(htva * 100) / 100;
id_other_tax = document.getElementById("other_tax_amount");
if (document.getElementById('tva')) id$('tva').innerHTML = Math.round(tva * 100) / 100;
if (document.getElementById ('htva'))
id$('htva').innerHTML = Math.round(htva * 100) / 100;
if (id_other_tax) {
tvac += id_other_tax.value;
}
if (g('tvac'))
g('tvac').innerHTML = Math.round(tvac * 100) / 100;
if (document.getElementById('tvac'))
id$('tvac').innerHTML = Math.round(tvac * 100) / 100;
}
function clean_tva(p_ctl) {
if (g('e_march' + p_ctl + '_tva_amount'))
g('e_march' + p_ctl + '_tva_amount').value = 0;
if (document.getElementById('e_march' + p_ctl + '_tva_amount'))
id$('e_march' + p_ctl + '_tva_amount').value = 0;
}
function clean_ledger(p_ctl_nb) {
if (g("e_march" + p_ctl_nb)) {
g("e_march" + p_ctl_nb).value = trim(g("e_march" + p_ctl_nb).value);
if (document.getElementById("e_march" + p_ctl_nb)) {
id$("e_march" + p_ctl_nb).value = trim(id$("e_march" + p_ctl_nb).value);
}
if (g('e_march' + p_ctl_nb + '_price')) {
g('e_march' + p_ctl_nb + '_price').value = '';
if (document.getElementById('e_march' + p_ctl_nb + '_price')) {
id$('e_march' + p_ctl_nb + '_price').value = '';
}
if (g('e_quant' + p_ctl_nb)) {
g('e_quant' + p_ctl_nb).value = '1';
if (document.getElementById('e_quant' + p_ctl_nb)) {
id$('e_quant' + p_ctl_nb).value = '1';
}
if (g('tva_march' + p_ctl_nb + '_show')) {
g('tva_march' + p_ctl_nb + '_show').value = '0';
if (document.getElementById('tva_march' + p_ctl_nb + '_show')) {
id$('tva_march' + p_ctl_nb + '_show').value = '0';
}
if (g('tva_march' + p_ctl_nb)) {
g('tva_march' + p_ctl_nb).value = 0;
if (document.getElementById('tva_march' + p_ctl_nb)) {
id$('tva_march' + p_ctl_nb).value = 0;
}
if (g('htva_march' + p_ctl_nb)) {
g('htva_march' + p_ctl_nb).value = 0;
if (document.getElementById('htva_march' + p_ctl_nb)) {
id$('htva_march' + p_ctl_nb).value = 0;
}
if (g('tvac_march' + p_ctl_nb)) {
g('tvac_march' + p_ctl_nb).value = 0;
if (document.getElementById('tvac_march' + p_ctl_nb)) {
id$('tvac_march' + p_ctl_nb).value = 0;
}
}
@ -714,12 +714,12 @@ function clean_ledger(p_ctl_nb) {
*/
function quick_writing_add_row() {
style = 'class="input_text"';
var mytable = g("quick_item").tBodies[0];
var mytable = id$("quick_item").tBodies[0];
var nNumberRow = mytable.rows.length;
var oRow = mytable.insertRow(nNumberRow);
var rowToCopy = mytable.rows[1];
var nNumberCell = rowToCopy.cells.length;
var nb = g("nb_item");
var nb = id$("nb_item");
var oNewRow = mytable.insertRow(nNumberRow);
for (var e = 0; e < nNumberCell; e++) {
@ -735,17 +735,17 @@ function quick_writing_add_row() {
new_tt.evalScripts();
}
var ck = $('ck' + nb.value);
var ck = id$('ck' + nb.value);
ck.addEventListener('click', function (event) {
display_range_dcside(event, ck);
display_dcside(ck);
});
$("qc_" + nb.value).value = "";
$("amount" + nb.value).value = "";
$("poste" + nb.value).value = "";
$("ld" + nb.value).value = "";
id$("qc_" + nb.value).value = "";
id$("amount" + nb.value).value = "";
id$("poste" + nb.value).value = "";
id$("ld" + nb.value).value = "";
nb.value++;
@ -805,7 +805,7 @@ function view_history_account(p_value, dossier, p_exercice) {
add_div(popup);
success_box(req, xml);
$(idbox).style.top = calcy(140 + (layer * 3)) + "px";
id$(idbox).style.top = calcy(140 + (layer * 3)) + "px";
}
}
);
@ -845,8 +845,8 @@ function view_history_anc_account(p_value, dossier, p_exercice) {
if (req.responseText === 'NOCONX') { reconnect();return;}
add_div(popup);
$(idbox).innerHTML = req.responseText;
$(idbox).style.top = calcy(140 + (layer * 3)) + "px";
id$(idbox).innerHTML = req.responseText;
id$(idbox).style.top = calcy(140 + (layer * 3)) + "px";
}
}
);
@ -881,7 +881,7 @@ function update_history_account(obj) {
if (req.responseText === 'NOCONX') { reconnect();return;}
success_box(req, xml);
g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
id$(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
}
});
} catch (e) {
@ -925,7 +925,7 @@ function view_history_card(p_value, dossier, p_exercice) {
add_div(popup);
success_box(req, xml);
g(idbox).style.top = calcy(140 + (layer * 3)) + "px";
id$(idbox).style.top = calcy(140 + (layer * 3)) + "px";
}
}
);
@ -962,8 +962,8 @@ function view_followup_card(p_value, dossier) {
if (req.responseText === 'NOCONX') { reconnect();return;}
add_div(popup);
$(idbox).update(req.responseText);
g(idbox).style.top = calcy(140 + (layer * 3)) + "px";
id$(idbox).update(req.responseText);
id$(idbox).style.top = calcy(140 + (layer * 3)) + "px";
}
}
);
@ -997,7 +997,7 @@ function update_history_card(obj) {
remove_waiting_box();
success_box(req, xml);
g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
id$(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
}
});
} catch (e) {
@ -1039,8 +1039,8 @@ function removeOperation(p_jr_id, dossier, div) {
*@param pointer to the FORM
*/
function reverseOperation(obj) {
var qs = $(obj).serialize() + "&op=ledger";
g('ext' + obj.divname).style.display = 'none';
var qs = id$(obj).serialize() + "&op=ledger";
id$('ext' + obj.divname).style.display = 'none';
waiting_box();
new Ajax.Request(
"ajax_misc.php",
@ -1112,8 +1112,8 @@ function modifyOperation(p_value, dossier) {
remove_waiting_box();
add_div(popup);
success_box(xml, txt);
$(id_div).style.position = "absolute";
$(id_div).style.top = calcy(100 + (layer * 3)) + "px";
id$(id_div).style.position = "absolute";
id$(id_div).style.top = calcy(100 + (layer * 3)) + "px";
}
}
);
@ -1154,9 +1154,9 @@ function dropLink(p_dossier, p_div, p_jr_id, p_jr_id2) {
*@see ICard::input
*/
function filter_card(obj, queryString) {
jrn = $('p_jrn').value;
jrn = id$('p_jrn').value;
if (jrn == -1) {
type = $('ledger_type').value;
type = id$('ledger_type').value;
queryString = queryString + '&type=' + type;
} else {
queryString = queryString + '&j=' + jrn;
@ -1182,10 +1182,10 @@ function dsp_letter(obj) {
onSuccess: success_dsp_letter
}
);
g('search').style.display = 'none';
g('list').style.display = 'none';
$('detail').innerHTML = loading();
g('detail').style.display = 'block';
id$('search').style.display = 'none';
id$('list').style.display = 'none';
id$('detail').innerHTML = loading();
id$('detail').style.display = 'block';
} catch (e) {
alert_box('dsp_letter failed ' + e.message);
}
@ -1203,20 +1203,20 @@ function success_dsp_letter(req) {
var name_ctl = a[0].firstChild.nodeValue;
var code_html = getNodeText(html[0]);
code_html = unescape_xml(code_html);
$('detail').innerHTML = code_html;
id$('detail').innerHTML = code_html;
} catch (e) {
alert_box(e.message);
}
try {
code_html.evalScripts();
} catch (e) {
alert_box("DSPLETTER:" + content[48] + e.message);
alert_box("DSPLETTER1:" + content[48] + e.message);
}
}
function error_dsp_letter(req) {
alert_box("DSPLETTER:" + content[48]);
alert_box("DSPLETTER2:" + content[48]);
}
function search_letter(obj) {
@ -1251,10 +1251,10 @@ function search_letter(obj) {
onSuccess: success_dsp_letter
}
);
$('list').hide();
$('search').hide();
$('detail').innerHTML = loading();
$('detail').show();
id$('list').hide();
id$('search').hide();
id$('detail').innerHTML = loading();
id$('detail').show();
} catch (e) {
alert_box('search_letter ' + e.message);
}
@ -1268,10 +1268,10 @@ function search_letter(obj) {
*/
function op_save(obj) {
try {
var queryString = $(obj).serialize(true);
var queryString = id$(obj).serialize(true);
queryString ["gDossier"] = obj.gDossier.value;
var rapt2 = "rapt" + obj.whatdiv.value;
queryString ["rapt"] = g(rapt2).value;
queryString ["rapt"] = id$(rapt2).value;
queryString ["jr_id"] = obj.jr_id.value;
var jr_id = obj.jr_id.value;
queryString ["div"] = obj.whatdiv.value;
@ -1283,7 +1283,7 @@ function op_save(obj) {
/*
* Operation detail is in a new window
*/
if (g('inpopup')) {
if (document.getElementById('inpopup')) {
var action = new Ajax.Request('ajax_misc.php',
{
method: 'post',
@ -1327,8 +1327,8 @@ function op_save(obj) {
try {
var answer = xml.responseXML;
var html = answer.getElementsByTagName('code');
$(divid).innerHTML = unescape(getNodeText(html[0]));
$(divid).innerHTML.evalScripts();
id$(divid).innerHTML = unescape(getNodeText(html[0]));
id$(divid).innerHTML.evalScripts();
remove_waiting_box();
} catch (e) {
console.error("D1. op_save")
@ -1348,8 +1348,8 @@ function op_save(obj) {
}
function get_history_account(ctl, dossier) {
if ($(ctl).value != '') {
view_history_account($(ctl).value, dossier);
if (document.getElementById(ctl).value != '') {
view_history_account(id$(ctl).value, dossier);
}
}
@ -1398,12 +1398,12 @@ function show_reconcile(p_div, p_let) {
function gestion_add_row() {
try {
style = 'class="input_text"';
var mytable = g("art").tBodies[0];
var mytable = id$("art").tBodies[0];
var ofirstRow = mytable.rows[1];
var line = mytable.rows.length;
var nCell = mytable.rows[1].cells.length;
var row = mytable.insertRow(line);
var nb = g("nb_item");
var nb = id$("nb_item");
for (var e = 0; e < nCell; e++) {
var newCell = row.insertCell(e);
var tt = ofirstRow.cells[e].innerHTML;
@ -1421,14 +1421,14 @@ function gestion_add_row() {
new_tt.evalScripts();
}
g("e_march" + nb.value + "_label").innerHTML = '&nbsp;';
g("e_march" + nb.value + "_label").value = '';
g("e_march" + nb.value + "_price").value = '0';
g("e_march" + nb.value).value = "";
g("e_quant" + nb.value).value = "1";
g('tvac_march' + nb.value).value = "0";
if ($("e_march" + nb.value + "_tva_amount"))
g("e_march" + nb.value + "_tva_amount").value = 0;
id$("e_march" + nb.value + "_label").innerHTML = '&nbsp;';
id$("e_march" + nb.value + "_label").value = '';
id$("e_march" + nb.value + "_price").value = '0';
id$("e_march" + nb.value).value = "";
id$("e_quant" + nb.value).value = "1";
id$('tvac_march' + nb.value).value = "0";
if (document.getElementById("e_march" + nb.value + "_tva_amount"))
id$("e_march" + nb.value + "_tva_amount").value = 0;
nb.value++;
@ -1446,7 +1446,7 @@ function document_remove(p_dossier, p_div, p_jrid) {
{
parameters: {"op": "ledger", "gDossier": p_dossier, "div": p_div, "p_jrid": p_jrid, 'act': 'rmf'},
onSuccess: function (x) {
$('receipt' + p_div).innerHTML = x.responseText;
id$('receipt' + p_div).innerHTML = x.responseText;
}
})
}
@ -1481,7 +1481,7 @@ function manage_search_filter(p_obj) {
'style': 'top:' + y + 'px;left:' + x + 'px;position:absolute;width:400px',
drag: 1
});
$('boxfilter' + p_obj.div).show();
id$('boxfilter' + p_obj.div).show();
}
});
}
@ -1503,11 +1503,11 @@ function save_filter(p_div, p_dossier) {
eltValue['gDossier'] = p_dossier;
eltValue['op'] = "save_filter";
eltValue['div'] = p_div;
eltValue['filter_name'] = $(p_div + "filter_new").value;
eltValue['filter_name'] = id$(p_div + "filter_new").value;
// Get all elt from the form
for (var i = 0; i < elt.length; i++) {
var idx = elt[i];
eltValue[idx] = $(p_div + elt[i]).value;
eltValue[idx] = id$(p_div + elt[i]).value;
}
if (eltValue['amount_min'] == "") eltValue["amount_min"] = 0;
@ -1518,7 +1518,7 @@ function save_filter(p_div, p_dossier) {
eltValue['r_jrn'] = [];
for (i = 0; i < eltValue['nb_jrn']; i++) {
var idx = p_div + 'r_jrn[' + i + ']';
eltValue['r_jrn' + i] = $(idx).value
eltValue['r_jrn' + i] = id$(idx).value
}
}
@ -1539,8 +1539,8 @@ function save_filter(p_div, p_dossier) {
var new_item = document.createElement('li');
new_item.innerHTML = answer.filter_name;
new_item.setAttribute("id", "manageli" + p_div + "_" + answer.filter_id);
$('manage' + p_div).appendChild(new_item);
$(p_div + "filter_new").value = "";
id$('manage' + p_div).appendChild(new_item);
id$(p_div + "filter_new").value = "";
} else {
throw answer.message;
}
@ -1570,10 +1570,10 @@ function load_filter(p_div, p_dossier, p_filter_id) {
, 'p_currency_code', 'tva_id_search'];
for (var i = 0; i < elt.length; i++) {
var idx = elt[i];
$(p_div + idx).value = answer[elt[i]];
id$(p_div + idx).value = answer[elt[i]];
}
// fillup the r_jrn array
var eltLedgerId = $("ledger_id" + p_div);
var eltLedgerId = id$("ledger_id" + p_div);
eltLedgerId.innerHTML = "";
var eltHidden = document.createElement("input");
eltHidden.setAttribute("name", p_div + "nb_jrn");
@ -1599,7 +1599,7 @@ function load_filter(p_div, p_dossier, p_filter_id) {
uf_tag: answer.uf_tag
},
onSuccess: function (req) {
$(p_div + 'tag_choose_td').update(req.responseText);
id$(p_div + 'tag_choose_td').update(req.responseText);
}
})
@ -1629,9 +1629,9 @@ function delete_filter(p_div, p_dossier, p_filter_id) {
try {
var answer = req.evalJSON;
var child = $("manageli" + p_div + "_" + p_filter_id);
var child = id$("manageli" + p_div + "_" + p_filter_id);
if (child) {
$("manage" + p_div).removeChild(child);
id$("manage" + p_div).removeChild(child);
}
} catch (e) {
console.log(e.message)
@ -1651,16 +1651,16 @@ function reset_filter(p_div) {
var elt = ['date_start', 'date_end', 'date_paid_start', 'date_paid_end', 'desc', 'amount_min', 'amount_max', 'qcode', 'accounting', 'tva_id_search'];
for (var i = 0; i < elt.length; i++) {
var idx = elt[i];
$(p_div + idx).value = "";
id$(p_div + idx).value = "";
}
if ($(p_div + "date_start_hidden")) {
$(p_div + "date_start").value = $(p_div + "date_start_hidden").value;
if (document.getElementById(p_div + "date_start_hidden")) {
id$(p_div + "date_start").value = id$(p_div + "date_start_hidden").value;
}
if ($(p_div + "date_end_hidden")) {
$(p_div + "date_end").value = $(p_div + "date_end_hidden").value;
if (document.getElementById(p_div + "date_end_hidden")) {
id$(p_div + "date_end").value = id$(p_div + "date_end_hidden").value;
}
// clean all the selected ledger
var eltLedgerId = $("ledger_id" + p_div);
var eltLedgerId = id$("ledger_id" + p_div);
eltLedgerId.innerHTML = "";
var eltHidden = document.createElement("input");
eltHidden.setAttribute("name", p_div + "nb_jrn");
@ -1670,7 +1670,7 @@ function reset_filter(p_div) {
eltLedgerId.appendChild(eltHidden);
// By default , unpaid is uncked
$(p_div + "operation_filter").value = "all";
id$(p_div + "operation_filter").value = "all";
}
function display_list_filter(p_dossier,access_code,ledger_type)
{
@ -1744,7 +1744,7 @@ function tax_detail_view (dossier_id,date_from,date_to,nLedger_id,nTva_id)
removeDiv(dgbox);
// For form , most of the parameters are in the FORM
// method is then POST
//var queryString=$(p_form_id).serialize(true);
//var queryString=id$(p_form_id).serialize(true);
var queryString = {
op: 'tax_detail',
@ -1771,7 +1771,7 @@ function tax_detail_view (dossier_id,date_from,date_to,nLedger_id,nTva_id)
var y=calcy(15);
var div_style="position:absolute;"+";top:"+y+"px";
add_div({id:dgbox,cssclass:'inner_box',html:loading(),style:div_style,drag:true});
$(dgbox).update(req.responseText);
id$(dgbox).update(req.responseText);
}
}
@ -1791,7 +1791,7 @@ var operation_exercice = {
waiting_box();
var queryString = {
op: 'operation_exercice+update_periode',
folder: $('dos_id').value,
folder: id$('dos_id').value,
gDossier: dossier_id
};
var action = new Ajax.Request(
@ -1807,7 +1807,7 @@ var operation_exercice = {
return;
}
$("select_exercice_id").update(req.responseText);
id$("select_exercice_id").update(req.responseText);
}
}
@ -1823,13 +1823,13 @@ var operation_exercice = {
removeDiv(dgbox);
// For form , most of the parameters are in the FORM
// method is then POST
//var queryString=$(p_form_id).serialize(true);
//var queryString=id$(p_form_id).serialize(true);
console.debug(row_operation_exercice);
var queryString = {
op: 'operation_exercice+modify_row',
oe_id: oe_id,
row_id: row_operation_exercice,
gDossier: $('gDossier').value
gDossier: id$('gDossier').value
};
var action = new Ajax.Request(
"ajax_misc.php",
@ -1847,7 +1847,7 @@ var operation_exercice = {
var y = calcy(15);
var div_style = "position:absolute;" + ";top:" + y + "px";
add_div({id: dgbox, cssclass: 'inner_box', html: loading(), style: div_style, drag: true});
$(dgbox).update(req.responseText);
id$(dgbox).update(req.responseText);
}
}
);
@ -1865,9 +1865,9 @@ var operation_exercice = {
// For form , most of the parameters are in the FORM
// method is then POST
//var queryString=$(p_form_id).serialize(true);
//var queryString=id$(p_form_id).serialize(true);
var queryString = $('operation_exercice_input_row_frm').serialize(true);
var queryString = id$('operation_exercice_input_row_frm').serialize(true);
var action = new Ajax.Request(
"ajax_misc.php",
@ -1890,24 +1890,24 @@ var operation_exercice = {
row.setAttribute("oed_id", rowid);
row.setAttribute("oe_id", req.responseJSON['oe_id']);
row.update(req.responseJSON['content']);
$("operation_exercice_tb").appendChild(row);
id$("operation_exercice_tb").appendChild(row);
row.addEventListener("click", function (event) {
operation_exercice.click_modify_row(row)
})
} else {
$("oe_" + rowid).update(req.responseJSON['content']);
id$("oe_" + rowid).update(req.responseJSON['content']);
}
new Effect.Highlight("oe_" + req.responseJSON['row_id'], {
startcolor: '#FAD4D4',
endcolor: '#F78082'
});
operation_exercice.display_total(rowid)
$(dgbox).remove();
id$(dgbox).remove();
return;
}
$(dgbox).update(req.responseText);
id$(dgbox).update(req.responseText);
}
}
@ -1925,7 +1925,7 @@ var operation_exercice = {
var queryString = {
op: 'operation_exercice+display_total',
row_id: row_id,
gDossier: $('gDossier').value
gDossier: id$('gDossier').value
};
var action = new Ajax.Request(
"ajax_misc.php",
@ -1940,7 +1940,7 @@ var operation_exercice = {
return;
}
$(dgbox).update(req.responseText);
id$(dgbox).update(req.responseText);
}
}
@ -1957,7 +1957,7 @@ var operation_exercice = {
var queryString = {
op: 'operation_exercice+delete_row',
row_id: row_id,
gDossier: $('gDossier').value
gDossier: id$('gDossier').value
};
var action = new Ajax.Request(
"ajax_misc.php",
@ -1974,8 +1974,8 @@ var operation_exercice = {
if (req.responseJSON["row_id"] != "") {
operation_exercice.display_total(req.responseJSON["row_id"])
}
$('oe_' + queryString['row_id']).remove();
$('operation_exercice_bx').remove();
id$('oe_' + queryString['row_id']).remove();
id$('operation_exercice_bx').remove();
}
}
);
@ -1994,7 +1994,7 @@ var operation_exercice = {
var dgbox = "oe_transfer_div";
waiting_box();
var queryString = $("operation_exercice_transfer_frm").serialize(true);
var queryString = id$("operation_exercice_transfer_frm").serialize(true);
var action = new Ajax.Request(
"ajax_misc.php",
{
@ -2009,7 +2009,7 @@ var operation_exercice = {
}
var answer=req.responseJSON;
$('operation_exercice_transfer_info').update(answer.content);
id$('operation_exercice_transfer_info').update(answer.content);
}

View file

@ -49,7 +49,7 @@ function search_accounting(obj)
removeDiv('search_account');
add_div({id:'search_account',cssclass:'inner_box',html:loading(),style:div_style,drag:false});
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString="gDossier="+dossier;
@ -61,8 +61,8 @@ function search_accounting(obj)
{
queryString+="&j="+obj.jrn;
}else {
if ($("p_jrn")) {
queryString+="&j="+$("p_jrn").value;
if (document.getElementById("p_jrn")) {
queryString+="&j="+id$("p_jrn").value;
}
}
if ( obj.account)
@ -97,10 +97,10 @@ function search_accounting(obj)
}
else
{
if ($(obj).account)
if (id$(obj).account)
{
var e=$(obj).account;
var str_account=$(e).value;
var e=id$(obj).account;
var str_account=id$(e).value;
queryString+="&q="+str_account;
}
}
@ -130,7 +130,7 @@ function search_accounting(obj)
*/
function search_get_poste(obj)
{
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString="gDossier="+dossier;
queryString+="&op=account";
@ -169,7 +169,7 @@ function search_get_poste(obj)
queryString+="&bracket";
}
$('asearch').innerHTML=loading();
id$('asearch').innerHTML=loading();
var action=new Ajax.Request ( 'ajax_misc.php',
{
method:'get',
@ -201,7 +201,7 @@ function result_poste_search(req)
var nodeXml=html[0];
var code_html=getNodeText(nodeXml);
code_html=unescape_xml(code_html);
$('search_account').innerHTML=code_html;
id$('search_account').innerHTML=code_html;
}
catch (e)
{

View file

@ -33,8 +33,8 @@ function folder_display(p_user)
*
*/
var p_filter = "";
if ($('database_filter_input')) {
p_filter = $('database_filter_input').value;
if (document.getElementById('database_filter_input')) {
p_filter = id$('database_filter_input').value;
}
/*
* Ajax request to display the folder
@ -46,11 +46,11 @@ function folder_display(p_user)
// table id = database_list
var folder = {};
var create = false;
if (!$('folder_list_div')) {
if (!document.getElementById('folder_list_div')) {
folder = create_div({'id': 'folder_list_div', 'cssclass': "inner_box", 'style': 'width:90%,right:5%;top:100px'});
create = true;
}
folder = $('folder_list_div');
folder = id$('folder_list_div');
// Analyze XML answer
var answer = p_xml.responseXML;
var a = answer.getElementsByTagName('status');
@ -66,7 +66,7 @@ function folder_display(p_user)
folder.innerHTML.evalScripts();
// show it
folder.show();
$('database_filter_input').focus();
id$('database_filter_input').focus();
}
});
}
@ -123,7 +123,7 @@ function folder_add(p_user, p_dossier)
}
var content = getNodeText(html[0]);
var nb = $('database_list').rows.length + 1;
var nb = id$('database_list').rows.length + 1;
var row = new Element('tr', {'id': 'row' + p_dossier});
if (nb % 2 == 0) {
row.addClassName('even');
@ -131,8 +131,8 @@ function folder_add(p_user, p_dossier)
row.addClassName('odd');
}
row.innerHTML = unescape_xml(content);
$('database_list').appendChild(row);
$('row_db_'+p_dossier).hide();
id$('database_list').appendChild(row);
id$('row_db_'+p_dossier).hide();
remove_waiting_box();
}
});
@ -157,16 +157,16 @@ function display_admin_answer(p_dossier,p_action)
var folder;
var create = false;
if (!$(div_display)) {
if (!document.getElementById(div_display)) {
folder = create_div({'id': div_display, 'cssclass': "inner_box", style: 'width:90%;right:5%;top:100px'});
create = true;
}
folder=$(div_display);
folder=id$(div_display);
var content = getNodeText(html[0]);
folder.innerHTML=unescape_xml(content);
var pos=calcy(250);
$(div_display).setStyle({top:pos+'px'});
id$(div_display).setStyle({top:pos+'px'});
folder.show();
remove_waiting_box();

View file

@ -27,29 +27,21 @@
/**
* clean the row (the label, price and vat)
* @param p_ctl the calling ctrl
* @param {string} p_ctl the calling ctrl
*/
function clean_Fid(p_ctl)
{
nSell=p_ctl+"_price";
nTvaAmount=p_ctl+"_tva_amount";
nBuy=p_ctl+"_price";
nTva_id=p_ctl+"_tva_id";
if ( $(nSell) )
{
$(nSell).value="";
document.getElementById(p_ctl).value='';
var aField=['_price','_tva_amount','_tva_id'];
for ( field of aField) {
let obj=document.getElementById(p_ctl+field);
if ( obj ) {obj.value='0'}
}
if ( $(nBuy) )
{
$(nBuy).value="";
}
if ( $(nTva_id) )
{
$(nTva_id).value="-1";
}
if ( $(nTvaAmount))
{
$(nTvaAmount).value=0;
var aField=['_label'];
for ( field of aField) {
let obj=document.getElementById(p_ctl+field);
if ( obj ) {obj.value=''}
}
}
function errorFid(request,json)
@ -58,7 +50,7 @@ function errorFid(request,json)
}
/**
* this function fills the data from fid.php,
* @param {object} p_ctl : field of the input,
* @param {object or string} p_ctl : field of the input, : object or string
* possible object member
* - label field to update with the card's name
* - price field to update with the card's price
@ -68,56 +60,56 @@ function errorFid(request,json)
*/
function ajaxFid(p_ctl)
{
debugger
try
{
var gDossier=$('gDossier').value;
var jrn=$(p_ctl).jrn;
$(p_ctl).value=$(p_ctl).value.toUpperCase();
if ( jrn == undefined )
var gDossier=id$('gDossier').value;
// if p_ctl is a string that find the object
var dome =id$(p_ctl);
var jrn = (dome.jrn) ? dome.jrn.value:-1;
dome.value=dome.value.toUpperCase();
if ( jrn == undefined && document.getElementById('p_jrn')!=undefined)
{
if ($('p_jrn')!=undefined)
{
jrn=$('p_jrn').value;
}
jrn=id$('p_jrn').value;
}
if ( jrn == undefined )
if ( trim(dome.value)=="" )
{
jrn=-1;
}
if ( trim($(p_ctl).value)=="" )
{
nLabel=$(p_ctl).label;
if ($(nLabel) )
nLabel=id$(dome).label;
if (document.getElementById(nLabel) )
{
$(nLabel).value="";
$(nLabel).innerHTML="&nbsp;";
clean_Fid(p_ctl);
id$(nLabel).value="";
id$(nLabel).innerHTML="&nbsp;";
clean_Fid(dome.id);
return;
}
}
var queryString="FID="+trim($(p_ctl).value);
if ( $(p_ctl).label)
var queryString="FID="+trim(dome.value);
if ( dome.label)
{
queryString+='&l='+$(p_ctl).label;
queryString+='&l='+dome.label;
}
if ( $(p_ctl).tvaid)
if ( dome.tvaid)
{
queryString+='&t='+$(p_ctl).tvaid;
queryString+='&t='+dome.tvaid;
}
if ( $(p_ctl).price)
if ( dome.price)
{
queryString+='&p='+$(p_ctl).price;
queryString+='&p='+dome.price;
}
if ( $(p_ctl).purchase)
if ( dome.purchase)
{
queryString+='&b='+$(p_ctl).purchase;
queryString+='&b='+dome.purchase;
}
if ( $(p_ctl).typecard)
if ( dome.typecard)
{
queryString+='&d='+$(p_ctl).typecard;
queryString+='&d='+dome.typecard;
}
queryString=queryString+"&j="+jrn+'&gDossier='+gDossier;
queryString=queryString+'&ctl='+p_ctl.id;
queryString=queryString+'&ctl='+dome.id;
queryString=encodeURI(queryString);
var action=new Ajax.Request (
@ -196,9 +188,9 @@ function ajax_error_saldo(request,json)
*/
function ajax_saldo(p_ctl)
{
var gDossier=$('gDossier').value;
var ctl_value=trim($(p_ctl).value);
var jrn=$('p_jrn').value;
var gDossier=id$('gDossier').value;
var ctl_value=trim(id$(p_ctl).value);
var jrn=id$('p_jrn').value;
queryString="FID="+ctl_value+"&op=saldo";
queryString=queryString+'&gDossier='+gDossier+'&j='+jrn;
queryString=queryString+'&ctl='+ctl_value;
@ -221,7 +213,7 @@ function ajax_saldo(p_ctl)
function ajax_success_saldo(request,json)
{
var answer=request.responseText.evalJSON(true);
$('first_sold').value=answer.saldo;
id$('first_sold').value=answer.saldo;
}
@ -231,8 +223,8 @@ function ajax_success_saldo(request,json)
function ajax_get_success(request,json)
{
var answer=request.responseText.evalJSON(false);
$(answer.ctl).show();
$(answer.ctl).innerHTML=answer.html;
id$(answer.ctl).show();
id$(answer.ctl).innerHTML=answer.html;
}
/*!\brief callback function for ajax_get when fails
*/
@ -252,7 +244,7 @@ var category_card={};
* @param string p_object_name , name of the prefix for id
*/
category_card.add_attribut=function (p_dossier,p_fiche_def_ref,p_object_name) {
var select=$("sel"+p_object_name);
var select=id$("sel"+p_object_name);
var selected_attr=select.value;
new Ajax.Request("ajax_misc.php",{
method:"post",
@ -268,7 +260,7 @@ category_card.add_attribut=function (p_dossier,p_fiche_def_ref,p_object_name) {
if ( answer.status == 'OK') {
var newli = document.createElement("li")
$(p_object_name + "_list").append(newli);
id$(p_object_name + "_list").append(newli);
newli.replace(answer.content);
document.getElementById('attribut_order').value = Sortable.serialize(p_object_name + "_list");
select.remove(select.selectedIndex);
@ -304,11 +296,11 @@ category_card.remove_attribut=function (p_dossier,p_fiche_def_ref,p_object_name,
onSuccess:function(req) {
var answer=req.responseText.evalJSON();
if ( answer.status == 'OK') {
$(p_object_name+"_elt"+p_attribute_id).remove();
id$(p_object_name+"_elt"+p_attribute_id).remove();
var option=document.createElement("option");
option.text=answer['content'];
option.value=p_attribute_id;
$('sel'+p_object_name).add(option);
id$('sel'+p_object_name).add(option);
} else {
smoke.alert(answer.message);
}
@ -328,11 +320,11 @@ category_card.check_vatnumber=function(p_domid) {
// For form , most of the parameters are in the FORM
// method is then POST
//var queryString=$(p_form_id).serialize(true);
//var queryString=id$(p_form_id).serialize(true);
var queryString = {
op: 'check_vatnumber',
vatnr:$(p_domid).value,
vatnr:id$(p_domid).value,
boxid: dgbox,
p_domid:p_domid
};
@ -352,14 +344,14 @@ category_card.check_vatnumber=function(p_domid) {
if ( answer.status == 'OK')
{
$(dgbox).update(answer.html);
$(p_domid).value=answer.vat;
$(p_domid).removeClassName("notice")
$(p_domid).addClassName("valid")
id$(dgbox).update(answer.html);
id$(p_domid).value=answer.vat;
id$(p_domid).removeClassName("notice")
id$(p_domid).addClassName("valid")
} else {
$(p_domid).addClassName("notice");
$(p_domid).removeClassName("valid");
$(dgbox).update(answer.html);
id$(p_domid).addClassName("notice");
id$(p_domid).removeClassName("valid");
id$(dgbox).update(answer.html);
}
}

View file

@ -31,7 +31,7 @@
*/
function add_row(p_table, p_seq)
{
var mytable = g(p_table).tBodies[0];
var mytable = id$(p_table).tBodies[0];
if (!mytable)
{
return;
@ -120,14 +120,14 @@ function anc_refresh_remain(p_table, p_seq)
var remain = tot_line - tot_table;
remain = Math.round(remain * 100) / 100;
$('remain' + p_table).innerHTML = remain;
id$('remain' + p_table).innerHTML = remain;
if (remain == 0)
{
$('remain' + p_table).style.color = "green"
id$('remain' + p_table).style.color = "green"
}
else
{
$('remain' + p_table).style.color = "red"
id$('remain' + p_table).style.color = "red"
}
} catch (a)
{
@ -152,7 +152,7 @@ function verify_ca(div)
while (idx < 50)
{
var table = div + 't' + idx;
if (g(table))
if (document.getElementById(table))
{
var total_amount = 0;
// table is found compute the different val[]
@ -182,12 +182,12 @@ function verify_ca(div)
var diff = amount*100 - total_amount*100;
if (Math.round(diff/100) != 0.0)
{
g(table).style.backgroundColor = 'red';
id$(table).style.backgroundColor = 'red';
amount_error++;
}
else
{
g(table).style.backgroundColor = 'lightgreen';
id$(table).style.backgroundColor = 'lightgreen';
}
idx++;
@ -216,7 +216,7 @@ function verify_ca(div)
*/
function search_ca(p_dossier, p_target, p_source)
{
var pa_id = g(p_source).value;
var pa_id = id$(p_source).value;
waiting_box();
removeDiv('search_anc');
var qs = "op=openancsearch&gDossier=" + p_dossier + "&ctl=searchanc";
@ -237,7 +237,7 @@ function search_ca(p_dossier, p_target, p_source)
cssclass: "inner_box",
style: pos
});
$('searchanc').innerHTML = req.responseText;
id$('searchanc').innerHTML = req.responseText;
} catch (e) {
alert_box(e.message);
@ -251,7 +251,7 @@ function search_anc_form(obj)
{
var qs = "op=resultancsearch&ctl=searchanc&";
var name = obj.id;
qs += $(name).serialize(false);
qs += id$(name).serialize(false);
waiting_box();
var action = new Ajax.Request('ajax_misc.php',
{
@ -261,7 +261,7 @@ function search_anc_form(obj)
onSuccess: function(req) {
try {
remove_waiting_box();
$('searchanc').innerHTML = req.responseText;
id$('searchanc').innerHTML = req.responseText;
req.responseText.evalScripts();
} catch (e) {
@ -281,16 +281,16 @@ function caod_checkTotal()
}// Ajouter getElementById par document.all[str]
var total_deb = 0.0;
var total_cred = 0.0;
var nb_item = g('nbrow').value;
var nb_item = id$('nbrow').value;
for (var i = 0; i < nb_item; i++)
{
var doc_amount = g("pamount" + i);
var doc_amount = id$("pamount" + i);
if (!doc_amount)
{
return;
}
var side = g("pdeb" + i);
var side = id$("pdeb" + i);
if (!side)
{
return;
@ -316,22 +316,22 @@ function caod_checkTotal()
var r_total_cred = Math.round(total_cred * 100) / 100;
var r_total_deb = Math.round(total_deb * 100) / 100;
g('totalDeb').innerHTML = r_total_deb;
g('totalCred').innerHTML = r_total_cred;
id$('totalDeb').innerHTML = r_total_deb;
id$('totalCred').innerHTML = r_total_cred;
if (r_total_deb != r_total_cred)
{
g("totalDiff").style.color = "red";
g("totalDiff").style.fontWeight = "bold";
g("totalDiff").innerHTML = "Différence";
id$("totalDiff").style.color = "red";
id$("totalDiff").style.fontWeight = "bold";
id$("totalDiff").innerHTML = "Différence";
var diff = total_deb - total_cred;
diff = Math.round(diff * 100) / 100;
g("totalDiff").innerHTML = diff;
id$("totalDiff").innerHTML = diff;
}
else
{
g("totalDiff").innerHTML = "0.0";
id$("totalDiff").innerHTML = "0.0";
}
}
@ -352,7 +352,7 @@ function anc_remove_operation(p_dossier, p_oa_group)
var queryString = encodeJSON(obj);
var e = new Ajax.Request("ajax_misc.php",
{method: 'get', parameters: queryString,onSuccess:function req() {
$("tr"+p_oa_group).remove();
id$("tr"+p_oa_group).remove();
}
});
@ -370,12 +370,12 @@ function anc_remove_operation(p_dossier, p_oa_group)
function anc_add_row(tableid)
{
var style = 'class="input_text"';
var mytable = g(tableid).tBodies[0];
var mytable = id$(tableid).tBodies[0];
var nNumberRow = mytable.rows.length;
var oRow = mytable.insertRow(nNumberRow);
var rowToCopy = mytable.rows[1];
var nNumberCell = rowToCopy.cells.length;
var nb = g("nbrow");
var nb = id$("nbrow");
var oNewRow = mytable.insertRow(nNumberRow);
for (var e = 0; e < nNumberCell; e++)
{
@ -388,7 +388,7 @@ function anc_add_row(tableid)
newCell.innerHTML = new_tt;
new_tt.evalScripts();
}
$("pamount" + nb.value).value = "0";
id$("pamount" + nb.value).value = "0";
nb.value++;
}
/**
@ -438,7 +438,7 @@ function anc_key_compute(p_dossier, p_table, p_amount, p_key_id)
var code_html = getNodeText(html[0]); // Firefox ne prend que les 4096 car.
code_html = unescape_xml(code_html);
$(name_ctl).innerHTML = code_html;
id$(name_ctl).innerHTML = code_html;
code_html.evalScripts();
removeDiv('div_anc_key_choice');
} catch (e)
@ -491,7 +491,7 @@ function anc_key_choice(p_dossier, p_table, p_amount,p_ledger)
code_html = unescape_xml(code_html);
var position=fixed_position(50,120);
add_div({id: name_ctl, cssclass: 'inner_box', style: position, drag: 1});
$(name_ctl).innerHTML = code_html;
id$(name_ctl).innerHTML = code_html;
} catch (e)
{
error_message(e.message);
@ -540,7 +540,7 @@ function anc_key_clean(p_dossier, p_table, p_amount,p_ledger,p_jrnx_id,p_sequenc
var code_html = getNodeText(html[0]); // Firefox ne prend que les 4096 car.
code_html = unescape_xml(code_html);
$(p_table+"t"+p_sequence).innerHTML=code_html;
id$(p_table+"t"+p_sequence).innerHTML=code_html;
} catch (e)
{
error_message(e.message);
@ -561,7 +561,7 @@ function anc_key_clean(p_dossier, p_table, p_amount,p_ledger,p_jrnx_id,p_sequenc
*/
function add_row_key(p_table)
{
var mytable = g(p_table).tBodies[0];
var mytable = id$(p_table).tBodies[0];
if (!mytable)
{
return;
@ -595,7 +595,7 @@ function add_row_key(p_table)
cell.innerHTML = txt;
}
}
$('total_key').innerHTML="?";
id$('total_key').innerHTML="?";
}
function anc_key_compute_table()
{
@ -615,7 +615,7 @@ function anc_key_compute_table()
}
tot=tot+Math.round(value*100)/100;
}
$('total_key').innerHTML=Math.round(tot*100)/100;
id$('total_key').innerHTML=Math.round(tot*100)/100;
}
@ -627,7 +627,7 @@ function anc_detail_op(p_oa_group,gDossier) {
parameters:{"gDossier":gDossier,"op":"anc_detail_op","oa_group":p_oa_group},
onSuccess:function (req) {
add_div({"id":"anc_detail_op_div","cssclass":"inner_box","style":"position:fixed;top:5%"});
$('anc_detail_op_div').update(req.responseText);
id$('anc_detail_op_div').update(req.responseText);
remove_waiting_box();
}
});

View file

@ -34,7 +34,7 @@ function boxsearch_card(p_dossier)
{
waiting_box();
removeDiv('boxsearch_card_div');
var queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+encodeURI($("card_search").value);
var queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+encodeURI(id$("card_search").value);
var action = new Ajax.Request(
"ajax_misc.php" ,
{
@ -49,8 +49,8 @@ function boxsearch_card(p_dossier)
var y=calcy(15);
var div_style="position:absolute;"+";top:"+y+"px";
add_div({id:'boxsearch_card_div',cssclass:'inner_box',html:loading(),style:div_style,drag:true});
$('boxsearch_card_div').innerHTML=req.responseText;
sorttable.makeSortable($('tb_fiche'));
id$('boxsearch_card_div').innerHTML=req.responseText;
sorttable.makeSortable(id$('tb_fiche'));
}
}
);
@ -76,9 +76,9 @@ function search_card(obj)
{
try
{
var gDossier=$('gDossier').value;
var gDossier=id$('gDossier').value;
var inp=obj.inp;
var string_to_search=$(inp).value;
var string_to_search=id$(inp).value;
var label=obj.label;
var typecard=obj.typecard;
var price=obj.price;
@ -93,8 +93,8 @@ function search_card(obj)
}
if ( jrn==undefined)
{
if ( g('p_jrn')) {
jrn=$('p_jrn').value;
if ( document.getElementById('p_jrn')) {
jrn=id$('p_jrn').value;
}
else {
jrn=-1;
@ -114,7 +114,7 @@ function search_card(obj)
'amount_from_type':amount_from_type,
'inactive_card':inactive_card
});
if ( $('search_card') ) {
if ( document.getElementById('search_card') ) {
removeDiv('search_card');
}
@ -164,7 +164,7 @@ function action_concerned_save_card(obj)
var nodeXml = html[0];
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
$(namectl).update(code_html);
id$(namectl).update(code_html);
removeDiv('search_card');
/* if dialog box exist with list other card, then refresh it */
if ( document.getElementById("action_concerned_list_dv") ) {
@ -222,7 +222,7 @@ function action_concerned_list(p_obj) {
code_html = unescape_xml(code_html);
$('action_concerned_list_dv').innerHTML = code_html;
id$('action_concerned_list_dv').innerHTML = code_html;
} catch (e) {
alert_box(e.message);
}
@ -336,9 +336,9 @@ function action_concerned_search_card(obj)
sx = document.body.scrollTop + 60;
}
var div_style = "top:" + sx + "px;height:52rem";
if ( ! $('search_card')) { add_div({id: 'search_card', cssclass: 'inner_box', html: "", style: div_style, drag: true}); }
$('search_card').innerHTML = code_html;
$('query').focus();
if ( ! document.getElementById('search_card')) { add_div({id: 'search_card', cssclass: 'inner_box', html: "", style: div_style, drag: true}); }
id$('search_card').innerHTML = code_html;
id$('query').focus();
activate_checkbox_range('select_card_ck');
}catch (e) {
alert_box(e.message);
@ -360,10 +360,11 @@ function action_concerned_search_card(obj)
*@param obj form
*@note the same as search_card, except it answer to a FORM and not
* to a click event
* @see ajax_card.php
*/
function search_get_card(obj)
{
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString="gDossier="+dossier;
queryString+="&op2=fs&op=card";
@ -417,7 +418,7 @@ function search_get_card(obj)
}
queryString=encodeURI(queryString);
$('asearch').innerHTML=loading();
id$('asearch').innerHTML=loading();
var action=new Ajax.Request ( 'ajax_misc.php',
{
@ -430,6 +431,7 @@ function search_get_card(obj)
}
/**
* show the answer of ajax request
* @see search_get_card
*@param answer in XML
*/
function result_card_search(req)
@ -466,9 +468,9 @@ function result_card_search(req)
var div_style="top:"+sx+"px;min-height:80%;height:auto";
add_div({id:'search_card',cssclass:'inner_box',html:"",style:div_style,drag:false,effect:'blinddown'});
$('search_card').innerHTML=code_html;
id$('search_card').innerHTML=code_html;
if ($('query')) { $('query').focus();}
if (document.getElementById('query')) { id$('query').focus();}
}
catch (e)
{
@ -500,12 +502,12 @@ function result_card_search(req)
*/
function setCtrl(p_ctrl,p_quickcode,p_ctrlname,p_label)
{
var ctrl=g(p_ctrl);
var ctrl=id$(p_ctrl);
if ( ctrl )
{
ctrl.value=p_quickcode;
}
var ctrl_name=g(p_ctrlname);
var ctrl_name=id$(p_ctrlname);
if ( ctrl_name )
{
ctrl_name.value=p_label;
@ -514,29 +516,7 @@ function setCtrl(p_ctrl,p_quickcode,p_ctrlname,p_label)
/**
* clean the row (the label, price and vat)
* @param p_ctl the calling ctrl
*/
function clean_Fid(p_ctl)
{
nSell=p_ctl+"_price";
nBuy=p_ctl+"_price";
nTva_id=p_ctl+"_tva_id";
if ( $(nSell) )
{
$(nSell).value="";
}
if ( $(nBuy) )
{
$(nBuy).value="";
}
if ( $(nTva_id) )
{
$(nTva_id).value="-1";
}
}
function errorFid(request,json)
{
alert_box(content[53]);
@ -583,7 +563,7 @@ function fill_fin_data_onchange(ctl)
function fill_fin_data(text,li)
{
ajaxFid(text);
ajax_saldo($(text.id));
ajax_saldo(id$(text.id));
}
/**
* show the ipopup window and display the details of a card,
@ -611,17 +591,17 @@ function fill_ipopcard(obj)
var popup={'id': content,'cssclass':'inner_box2','style':str_style,'html':"",'drag':false};
add_div(popup);
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var qcode='';
if ( $(obj).qcode != undefined )
if ( obj.qcode != undefined )
{
qcode=obj.qcode;
}
else
{
qcode=$(obj).value;
qcode=id$(obj).value;
}
// ctl=$(obj).id;
// ctl=id$(obj).id;
var queryString='gDossier='+dossier;
queryString+='&qcode='+qcode;
@ -671,7 +651,7 @@ function successFill_ipopcard(req,json)
var code_html=getNodeText(html[0]);
code_html=unescape_xml(code_html);
$(name_ctl).innerHTML=code_html;
id$(name_ctl).innerHTML=code_html;
}
catch (e)
{
@ -698,16 +678,16 @@ function successFill_ipopcard(req,json)
*/
function select_card_type(obj)
{
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var elementId="";
// give a filter, -1 if not
var filter=$(obj).filter;
var filter=id$(obj).filter;
if ( filter==undefined)
{
filter=-1;
}
var content="select_card_div";
if ( $(content)){removeDiv(content);}
if ( document.getElementById(content)){removeDiv(content);}
var sx=0;
sx=calcy(160);
@ -721,25 +701,25 @@ function select_card_type(obj)
queryString+='&ctl='+content;
queryString+='&op2=st'; // st for selecting type
queryString+='&op=card'; // st for selecting type
if ( $(obj).win_refresh!=undefined)
if ( document.getElementById(obj).win_refresh!=undefined)
{
queryString+='&ref';
}
/* if an element id must be updated after creating a new card */
if ( $(obj).elementId) {
var elementId=$(obj).elementId;
if ( document.getElementById(obj).elementId) {
var elementId=id$(obj).elementId;
queryString+="&eltid="+elementId;
}
queryString+='&fil='+filter;
// filter on the ledger, -1 if not
var oledger=$(obj).jrn;
var oledger=id$(obj).jrn;
if (oledger==undefined)
{
ledger=-1;
}
else
{
ledger=$(obj).jrn;
ledger=id$(obj).jrn;
}
queryString+='&ledger='+ledger;
@ -773,7 +753,7 @@ function select_card_type(obj)
return;
}
fill_box(req);
$('lk_cat_card_table').focus();
id$('lk_cat_card_table').focus();
}
}
);
@ -810,7 +790,7 @@ function dis_blank_card(obj)
add_div(popup);
if ( obj.gDossier.value != undefined ) {
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
} else {
var dossier=obj.gDossier;
}
@ -848,11 +828,11 @@ function form_blank_card(obj)
var str_style="top:"+nTop+"px;left:"+nLeft+"px;width:60em;height:auto";
var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true};
if ( $(content)) {removeDiv(content);}
if ( document.getElementById(content)) {removeDiv(content);}
add_div(popup);
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString='gDossier='+dossier;
queryString+='&ctl='+content;
@ -878,8 +858,8 @@ function form_blank_card(obj)
*/
function save_card(obj)
{
var content=$(obj).ipopup;
var accounting= $(obj)['av_text5'];
var content=id$(obj).ipopup;
var accounting= id$(obj)['av_text5'];
if ( accounting && accounting.value.length > 40 ) {
smoke.alert('Poste comptable trop grand');
return false;
@ -887,9 +867,9 @@ function save_card(obj)
// Data must be taken here
var data=$('save_card').serialize(false);
var data=id$('save_card').serialize(false);
waiting_box();
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString='gDossier='+dossier;
queryString+='&ctl='+content;
queryString+=data;
@ -922,7 +902,7 @@ function save_card(obj)
// if status == OK and after_save == 1
// then add a row to the table
if ( status_value == 'OK' && after_save == 1) {
var table_card=$('fiche_tb_id');
var table_card=id$('fiche_tb_id');
f_id=getNodeText(req.responseXML.getElementsByTagName("f_id")[0]);
var row=new Element('tr');
row.id="row_card"+f_id;
@ -943,9 +923,9 @@ function save_card(obj)
var eltid=getNodeText(elt[0]);
if ( eltid !="") {
var eltvalue=req.responseXML.getElementsByTagName("elt_value");
$(eltid).value=getNodeText(eltvalue[0]);
id$(eltid).value=getNodeText(eltvalue[0]);
fill_data_onchange(eltid);
$(eltid).focus();
id$(eltid).focus();
}
}
if (status_value == "OK") {
@ -984,12 +964,12 @@ function add_category(obj)
// show ipopup
var div={id:obj.ipopup,
cssclass:"inner_box",drag:1,style:div_style};
if ( $(div) ) {
if ( document.getElementById(div) ) {
removeDiv(div);
}
add_div(div);
waiting_box();
var dossier=$('gDossier').value;
var dossier=id$('gDossier').value;
var queryString='gDossier='+dossier;
queryString+='&op2=ac';
queryString+='&op=card';
@ -1014,15 +994,15 @@ function add_category(obj)
*/
function save_card_category(obj)
{
if ( ! $(obj).ipopup)
if ( ! document.getElementById(obj).ipopup)
{
alert_box('Erreur pas d\' attribut ipopup '+obj.id);
return;
};
try {
// Data must be taken here
data=$('newcat').serialize(false);
var dossier=$('gDossier').value;
data=id$('newcat').serialize(false);
var dossier=id$('gDossier').value;
var queryString='ctl='+obj.ipopup+'&';
queryString+=data;
queryString+='&op2=scc'; // sc for save card
@ -1124,7 +1104,7 @@ function action_save_concerned(p_form_id) {
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
removeDiv('search_card');
$('concerned_card_td').innerHTML = code_html;
id$('concerned_card_td').innerHTML = code_html;
} catch (e) {
}
@ -1156,10 +1136,10 @@ function action_remove_concerned(p_dossier,p_fiche_id,p_action_id)
var nodeXml=html[0];
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
$('concerned_card_td').innerHTML = code_html;
id$('concerned_card_td').innerHTML = code_html;
removeDiv('search_card');
$(namectl).remove();
id$(namectl).remove();
} catch (e) {
if ( console) { console.log('Erreur ') + e.message;}
@ -1234,7 +1214,7 @@ function modify_card(p_fiche_id)
console.error("card_gdossier error");
throw ("card_gdossier not set");
}
var dossier = $('card_gdossier').value;
var dossier = id$('card_gdossier').value;
var action = new Ajax.Request('ajax_misc.php',
@ -1262,8 +1242,8 @@ function delete_card_id(p_fiche_id)
console.error("card_gdossier error");
throw ("card_gdossier not set");
}
$(row).addClassName("background-selected");
var dossier = $('card_gdossier').value;
id$(row).addClassName("background-selected");
var dossier = id$('card_gdossier').value;
smoke.confirm(content[47], function (e) {
if (e) {
waiting_box();
@ -1272,7 +1252,7 @@ function delete_card_id(p_fiche_id)
parameters: {'gDossier':dossier,"op":'card',"op2":"rm_card","f_id":p_fiche_id,'ctl':row} ,
onSuccess: function (req) {
remove_waiting_box();
var table_card=$('fiche_tb_id');
var table_card=id$('fiche_tb_id');
var answer = req.responseXML;
var a = answer.getElementsByTagName('ctl');
if (a.length == 0)
@ -1288,7 +1268,7 @@ function delete_card_id(p_fiche_id)
if ((code_html) == "OK") {
Effect.Fade(row, {duration: 0.1});
table_card.tBodies[0].removeChild($(row));
table_card.tBodies[0].removeChild(id$(row));
alternate_row_color("fiche_tb_id");
} else {
smoke.alert(code_html);
@ -1298,7 +1278,7 @@ function delete_card_id(p_fiche_id)
});
} else{
$(row).removeClassName("background-selected");
id$(row).removeClassName("background-selected");
}
});
@ -1338,11 +1318,11 @@ function card_update_row(obj)
if ( document.getElementById(name_ctl)) {
// update the row
$(name_ctl).innerHTML = code_html;
id$(name_ctl).innerHTML = code_html;
new Effect.Highlight(name_ctl ,{startcolor: '#FAD4D4',endcolor: '#F78082' });
}
$(a[0].firstChild.nodeValue).remove();
id$(a[0].firstChild.nodeValue).remove();
} catch (e) {
@ -1391,7 +1371,7 @@ function linked_card_option(p_action_person_id,p_dossier) {
onSuccess:function(req) {
remove_waiting_box();
add_div({ "id":"d_linked_card_option",cssclass:"inner_box",style:"position:fixed;top:30%;min-width:20rem;width:auto;",drag:0});
$("d_linked_card_option").update(req.responseText);
id$("d_linked_card_option").update(req.responseText);
}
});
@ -1414,7 +1394,7 @@ function save_linked_card_option(obj)
onSuccess:function(req) {
remove_waiting_box();
removeDiv("d_linked_card_option");
$("other_"+obj.action_person_id.value).update(req.responseText);
id$("other_"+obj.action_person_id.value).update(req.responseText);
new Effect.Highlight("other_"+obj.action_person_id.value,{startcolor: '#FAD4D4',endcolor: '#F78082' });
}
});
@ -1503,10 +1483,10 @@ CategoryCardDefinition.prototype.add_attribut = function (attribut_id) {
// if successfull add id on existing_list and remove from available_list
// remove from available_list
$('avail_attr_' + attribut_id).remove();
id$('avail_attr_' + attribut_id).remove();
var parser = new DOMParser();
var element = parser.parseFromString(req.responseText, 'text/html');
$(here.existing_list).appendChild(element.body.firstChild);
id$(here.existing_list).appendChild(element.body.firstChild);
new Effect.Highlight('existing_attr_' + attribut_id, {
startcolor: '#FAD4D4',
endcolor: '#F78082'
@ -1551,10 +1531,10 @@ CategoryCardDefinition.prototype.remove_attribut = function (attribut_id) {
// if successfull add id on existing_list and remove from available_list
// remove from available_list
$('existing_attr_' + attribut_id).remove();
id$('existing_attr_' + attribut_id).remove();
var parser = new DOMParser();
var element = parser.parseFromString(req.responseText, 'text/html');
$(here.available_list).appendChild(element.body.firstChild);
id$(here.available_list).appendChild(element.body.firstChild);
alternate_row_color_list(here.available_list);
Sortable.create('attribut_card', {tag: 'li', hoverclass: inner_box});

View file

@ -81,9 +81,9 @@ function displaySelectBox(p_name) {
newDiv.id="select_box_content"+p_name;
document.body.appendChild(newDiv);
newDiv.addClassName("select_box");
$("select_box_content"+p_name).onmouseleave=function() {
id$("select_box_content"+p_name).onmouseleave=function() {
try {
var newDiv=$("select_box_content"+p_name);
var newDiv=id$("select_box_content"+p_name);
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
@ -92,7 +92,7 @@ function displaySelectBox(p_name) {
} else {
newDiv=document.getElementById("select_box_content"+p_name);
}
newDiv.innerHTML=$("select_box"+p_name).innerHTML;
newDiv.innerHTML=id$("select_box"+p_name).innerHTML;
var viewport = document.viewport.getDimensions();
var locPosY=posY;
if ( posY+offsetY+ newDiv.getHeight() > window.innerHeight -3) {
@ -101,14 +101,15 @@ function displaySelectBox(p_name) {
newDiv.style.top=locPosY+"px";
newDiv.style.left=document.getElementById(p_name+"_bt").offsetLeft+"px";
newDiv.setStyle({display:"block",position:"absolute","z-index":999});
card_layer++;
newDiv.setStyle({display:"block",position:"absolute","z-index":card_layer});
if ( $("search_"+p_name+"_list") ) {
if ( id$("search_"+p_name+"_list") ) {
var sTmp = newDiv.innerHTML;
var regex=new RegExp(p_name+"_list","g");
sTmp = sTmp.replace(regex,p_name+"_t_list");
newDiv.innerHTML=sTmp;
$("search_"+p_name+"_t_list").focus();
id$("search_"+p_name+"_t_list").focus();
}
} catch(e) {
alert(e.message);

View file

@ -384,7 +384,7 @@ var ManageTable = function (p_table_name)
$(obj.id).setStyle(here.mt_style);
remove_waiting_box();
$(obj.id).update(x['html']);
Effect.SlideDown(obj.id,{duration:0.3,scaleX:false,scaleY:true,scaleContent:false});
$(obj.id).show();
} catch (e) {
smoke.alert(content[48] + e.message);
}

View file

@ -71,8 +71,8 @@ function modify_document_success_box(req,json)
var code_html=getNodeText(html[0]);
code_html=unescape_xml(code_html);
g(name_ctl).innerHTML=code_html;
g(name_ctl).style.height='auto';
id$(name_ctl).innerHTML=code_html;
id$(name_ctl).style.height='auto';
}
catch (e)
{

22
html/js/noalyss_debug.js Normal file
View file

@ -0,0 +1,22 @@
/*
* 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
*/
/**
* @file this file is for enable debug , just check variable document.debug_noalyss
*/
document.debug_noalyss=true;

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,7 @@ msgstr ""
"Project-Id-Version: NOALYSS 672\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-07 17:50+0200\n"
"PO-Revision-Date: 2024-09-10 10:26+0200\n"
"PO-Revision-Date: 2022-08-30 00:39+0200\n"
"Last-Translator: dany <dany@galactee.intra-alchimerys.be>\n"
"Language-Team: French <kde-i18n-doc@kde.org>\n"
"Language: en_US\n"
@ -18028,7 +18028,7 @@ msgstr "List depreciable property"
#: include/database.item.php:94 include/database.item.php:88
#: include/database.item.php:90 include/database.item.php:74
msgid "Liste des changements manuels des stocks"
msgstr "List of books stock changes"
msgstr "History "
#: include/database.item.php:98 include/database.item.php:101
#: include/database.item.php:95 include/database.item.php:93
@ -18050,7 +18050,7 @@ msgstr "List of contacts"
#: include/ext/skel/index.php:46 include/ext/tva/index.php:35
#: include/ext/tva/index.php:38 include/ext/tva/index.php:39
msgid "Liste des déclarations TVA"
msgstr "List of VAT returns"
msgstr "History VAT forms"
#: include/template/operation_exercice-list_draft.php:40
#, fuzzy
@ -18065,7 +18065,7 @@ msgstr "Folders"
#: include/impress_jrn.inc.php:147 include/impress_jrn.inc.php:140
msgid "Liste détaillées opérations "
msgstr "List of detailled entries"
msgstr "Detailled List "
#: include/search.inc.php:118 include/search.inc.php:119
#: include/ajax/ajax_search_operation.php:119

View file

@ -24,26 +24,28 @@
*
* - first do not forget to create the authorized_debug file in the html folder
* - secund the test must be adapted to this page : if you do a post (or get) from a test, you won't get any result
* if the $_REQUEST[test_select] is not set, so set it .
* if the $_REQUEST[test_select] is not set, so set it .
*
*
*/
include_once("../include/constant.php");
include_once("lib/ac_common.php");
require_once('class/database.class.php');
require_once ('class/dossier.class.php');
require_once('lib/html_input.class.php');
require_once('lib/icon_action.class.php');
require_once ('lib/function_javascript.php');
require_once 'class/noalyss_user.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
html_page_start();
global $http;
define ('TEST_UNIT',1);
$http=new HttpInput();
if ( ini_get('zend.assertions') != 1 ) {
echo_warning(_('Attention zend.assertions devrait être activé'));
echo p('Il faut changer dans votre fichier .htaccess ou php.ini');
echo 'voir <a href="https://www.php.net/manual/fr/ini.core.php#ini.zend.assertions">https://www.php.net/manual/fr/ini.core.php#ini.zend.assertions</a>';
}
$gDossier=$http->request('gDossier',"number", -1);
if ($gDossier==-1)
{
@ -64,20 +66,27 @@ if (!file_exists('authorized_debug'))
exit();
}
define('ALLOWED', 1);
global $aAvaible_module;
/*
* Find all the folders
*/
$directory=NOALYSS_BASE."/scenario";
$folder=scandir($directory);
$nb_folder=count($folder);
for ($i=0; $i<$nb_folder;$i++)
{
if (is_dir("{$directory}/".$folder[$i]) && $folder[$i] != '.' && $folder[$i] !='..')
{
$aAvaible_module[]=$folder[$i];
}
}
load_all_script();
// To enable assert , set "zend.assertions" in the php.ini file
ini_set("assert.active",1);
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
//removed in PHP8 assert_options(ASSERT_QUIET_EVAL, 1);
function my_assert_handler($file, $line, $code)
{
echo "<hr>Assert Failed :
File '$file'<br />
Line '$line'<br />
Code '$code'<br /><hr />";
}
assert_options(ASSERT_CALLBACK, 'my_assert_handler');
/******************************************************************************************************************/
/* Utilities
/******************************************************************************************************************/
@ -97,34 +106,81 @@ function get_card_with_activity() {
}
/*
* Loading of all scenario
* Loading of all scenario HTML + XML
*/
$scan=scandir('../scenario/');
$maxscan=count($scan);
$cnt_scenario=0;$scenario=array();
function retrieve_files($directory) :array
{
$scan=scandir($directory);
$maxscan=count($scan);
$cnt_scenario=0;$scenario=array();
for ($e_scan=0; $e_scan<$maxscan; $e_scan++)
{
if (is_file('../scenario/'.$scan[$e_scan])&&strpos($scan[$e_scan], '.php')==true)
for ($e_scan=0; $e_scan<$maxscan; $e_scan++)
{
$description="";
$a_description=file('../scenario/'.$scan[$e_scan]);
$max_description=count($a_description);
for ($w=0; $w<$max_description; $w++)
if (is_file("{$directory}/".$scan[$e_scan])&&strpos($scan[$e_scan], '.php')==true)
{
if (strpos($a_description[$w], '@description:')==true)
$description="";
$a_description=file("{$directory}/".$scan[$e_scan]);
$max_description=count($a_description);
for ($w=0; $w<$max_description; $w++)
{
$description=$a_description[$w];
$description=noalyss_str_replace('//@description:', '', $description);
if (strpos($a_description[$w], '@description:')==true)
{
$description=$a_description[$w];
$description=noalyss_str_replace('//@description:', '', $description);
}
}
$scenario[$cnt_scenario]['file']="{$directory}/".$scan[$e_scan];
$scenario[$cnt_scenario]['desc']=$description;
$cnt_scenario++;
}
$scenario[$cnt_scenario]['file']=$scan[$e_scan];
$scenario[$cnt_scenario]['desc']=$description;
$cnt_scenario++;
}
return $scenario;
}
function display_test($title,$gDossierLogInput,$aHtml_files)
{
echo h1($title);
$get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'description'=>"Tous les scripts",'module'=>$title));
echo '<table style="collapse: false;border-spacing: 1rem">';
echo '<tr>';
echo '<td>';
echo '<a href="'.$get.'" target="_blank">';
echo "Tous les tests du module $title ";
echo '</a>';
echo '</td>';
echo '<td>';
echo '<a href="'.$get.'" target="_blank">';
echo 'Tous les scripts';
echo '</a>';
echo '</td>';
echo '</tr>';
$nb_html=count($aHtml_files);
for ($e=0; $e<$nb_html; $e++)
{
$get='test.php?'.http_build_query(array('script'=>$aHtml_files[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$aHtml_files[$e]['desc']));
echo '<tr>';
echo '<td>';
echo $e;
echo '</td>';
echo '<td>';
echo '<a href="'.$get.'" target="_blank">';
echo basename($aHtml_files[$e]['file']);
echo '</a>';
echo '</td>';
echo '<td>'.$aHtml_files[$e]['desc'].'</td>';
echo '</tr>';
}
echo '</table>';
}
$script=$http->request('script', "string",'');
$min=$cn->get_value("select p_id from parm_periode order by p_start asc limit 1");
$max=$cn->get_value("select p_id from parm_periode order by p_start desc limit 1");
@ -137,81 +193,76 @@ if ($script=="")
* cherche pour fichier a include, s'il y en a alors les affiche
* avec une description
*/
echo '<table>';
$get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'description'=>"Tous les scripts"));
echo '<tr>';
echo '<td>';
echo '<a href="'.$get.'" target="_blank">';
echo "Tous ";
echo '</a>';
echo '</td>';
echo '<td>Tous les scripts</td>';
echo '</tr>';
print '<p class="alert-primary p-2 w-50">';
printf( '<a href="%s" target="_blank"> Tous les test </a>',$get);
print '</p>';
foreach ($aAvaible_module as $mod) {
$html_files = retrieve_files(NOALYSS_BASE . '/scenario/' . $mod);
display_test($mod,$gDossierLogInput,$html_files);
for ($e=0; $e<$cnt_scenario; $e++)
{
$get='test.php?'.http_build_query(array('script'=>$scenario[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$scenario[$e]['desc']));
echo '<tr>';
echo '<td>';
echo $e;
echo '</td>';
echo '<td>';
echo '<a href="'.$get.'" target="_blank">';
echo $scenario[$e]['file'];
echo '</a>';
echo '</td>';
echo '<td>'.$scenario[$e]['desc'].'</td>';
echo '</tr>';
}
echo '</table>';
}
else if ($script=='all')
{
$nb=$http->get('nb_script', "number",0);
$nb=$http->get('nb_script', "number",1);
$start_mem=memory_get_usage();
$start_time=microtime(true);
$script=noalyss_str_replace('../', '', $script);
echo '<h1>'.$nb." ".$scenario[$nb]['file']."</h1>";
echo '<h2> description = '.$scenario[$nb]["desc"].'</h2>';
include '../scenario/'.$scenario[$nb]['file'];
echo '</div>';
echo '</div>';
$end_mem=memory_get_usage();
$end_time=microtime(true);
$module=$http->get('module','string','all');
$scenario=[];
if ($module=='all') {
foreach ($aAvaible_module as $mod) {
$html_files = retrieve_files(NOALYSS_BASE . '/scenario/' . $mod);
$scenario = array_merge($html_files, $scenario);
}
} elseif (in_array($module, $aAvaible_module) ) {
$scenario=retrieve_files(NOALYSS_BASE.'/scenario/'.$module);
echo "<p>start mem : ".$start_mem;
echo '</p>';
echo "<p>end mem : ".$end_mem;
echo '</p>';
echo "<p>Diff = ".($end_mem-$start_mem)." bytes ";
echo "<p>Diff = ".(round(($end_mem-$start_mem)/1024, 2))." kbytes ";
echo "<p>Diff = ".(round(($end_mem-$start_mem)/1024/1024, 2))." Mbytes ";
echo '</p>';
echo "<p>Execution script ".$script." time = ".(round(($end_time-$start_time), 4))." secondes</p>";
$nb++;
if ( $nb == $maxscan ) {
echo "Dernier test";
} else {
$get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'nb_script'=>$nb));
echo '<a href="'.$get.'" target="_blank">';
echo $scenario[$nb]['file'];
}
$maxscan=$http->get('nb_script', "number",count($scenario)-1);
$maxscan++;
for ($i=$nb;$i< $maxscan;$i++) {
echo '<h1>'.$nb." ".$scenario[$nb]['file']."</h1>";
echo '<h2> description = '.$scenario[$nb]["desc"].'</h2>';
include $scenario[$nb]['file'];
echo '</div>';
echo '</div>';
$end_mem=memory_get_usage();
$end_time=microtime(true);
echo "<p>start mem : ".$start_mem;
echo '</p>';
echo "<p>end mem : ".$end_mem;
echo '</p>';
echo "<p>Diff = ".($end_mem-$start_mem)." bytes ";
echo "<p>Diff = ".(round(($end_mem-$start_mem)/1024, 2))." kbytes ";
echo "<p>Diff = ".(round(($end_mem-$start_mem)/1024/1024, 2))." Mbytes ";
echo '</p>';
echo "<p>Execution script ".$script." time = ".(round(($end_time-$start_time), 4))." secondes</p>";
$nb++;
if ( $nb == $maxscan ) {
echo "Dernier test";
} else {
$get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'nb_script'=>$nb));
echo '<a href="'.$get.'" target="_blank">';
echo $scenario[$nb]['file'];
echo '</a>';
}
}
}
else
{
$start_mem=memory_get_usage();
$start_time=microtime(true);
$script=noalyss_str_replace('../', '', $script);
$description=$http->get("description","string", "aucune description");
echo '<h1>'.$script."</h1>";
echo '<p> description = '.$description.'<p>';
include '../scenario/'.$script;
include $script;
$end_mem=memory_get_usage();
$end_time=microtime(true);
@ -225,4 +276,4 @@ else
echo "<p>Diff = ".(round(($end_mem-$start_mem)/1024/1024, 2))." Mbytes ";
echo '</p>';
echo "<p>Execution script ".$script." time = ".(round(($end_time-$start_time), 4))." secondes</p>";
}
}

View file

@ -326,7 +326,8 @@ case 'st':
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.',\''.$eltid.'\')">'.h($array[$i]['fd_label']).'</a>';
$r.='</td>';
$r.='<td>';
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.',\''.$eltid.'\')">'.h($array[$i]['fd_description'])."($nb_count)".'</a>';
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.',\''.$eltid.'\')">'.h
($array[$i]['fd_description'])."($nb_count)".'</a>';
$r.='</td>';
$r.="</tr>";
@ -342,7 +343,7 @@ case 'st':
}
$xml=escape_xml($html);
header('Content-type: text/xml; charset=UTF-8');
if (!defined("TEST_UNIT")) header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>

View file

@ -231,7 +231,8 @@ $html.=$date_error;
// echo $html;exit;
$html=escape_xml($html);
header('Content-type: text/xml; charset=UTF-8');
if (! defined('TEST_UNIT'))
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>

View file

@ -94,8 +94,6 @@ if ($ledger == "") {
$html = escape_xml($html);
if (!headers_sent()) {
header('Content-type: text/xml; charset=UTF-8');
} else {
echo "HTML" . unescape_xml($html);
}
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
@ -397,7 +395,7 @@ switch ($action) {
', array($jr_id));
$cn->exec_sql("select comptaproc.jrn_add_note($1,$2)",
array($jr_id, $http->post('jrn_note')));
$rapt = $_POST['rapt'];
$rapt = $http->post('rapt');
if ($g_parameter->MY_UPDLAB == 'Y' && isset ($_POST['j_id'])) {
$a_rowid = $http->post("j_id");
@ -486,7 +484,7 @@ switch ($action) {
case 'ask_extdate':
$date = new IDate('p_date');
$html .= "<form id=\"form_" . $div . "\" onsubmit=\"return reverseOperation(this);\">";
$html .= HtmlInput::hidden('jr_id', $_REQUEST['jr_id']) .
$html .= HtmlInput::hidden('jr_id', $http->request('jr_id','number')) .
HtmlInput::hidden('div', $div) .
dossier::hidden() .
HtmlInput::hidden('act', 'reverseop');
@ -543,10 +541,9 @@ switch ($action) {
$html = escape_xml($html);
if (!headers_sent()) {
header('Content-type: text/xml; charset=UTF-8');
} else {
echo "HTML" . unescape_xml($html);
}
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>

View file

@ -18,8 +18,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*! \file
/*!
* \file
* \brief Search module
* \see javascript search_reconcile
\param dossier_id int in $_GET dossier id needed to connect to the right folder
\param ctlc in $_GET string of DOM ID that receives the result when operation is selected
\param tiers in $_GET
\param amount_id float in $_GET amount to search
\param target in $_GET element to update
\param hide_operation in $_GET
\param single_operation in $_GET
*/
/**
* @var $op comes from $_GET['op'] , that is the parameter from ajax to select the action (route) to perform.
* @var $g_user type of Noalyss_User , connected user
*/
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
@ -35,6 +50,7 @@ $cn=Dossier::connect();
$base=basename($_SERVER['PHP_SELF']);
$inside=false;
$tiers=$http->get("tiers", "string", "");
// With the amount id, we find the amount in a html elt
@ -83,7 +99,8 @@ if (isset($_GET['amount_min'])&&isset($_GET['amount_max'])&&($_GET['amount_max']
);
}
//-----------------------------------------------------
// Display search result
// Display search result, value from the search FORM
//
//-----------------------------------------------------
if (isset($_GET['viewsearch']))
{

View file

@ -120,7 +120,7 @@ if ($sa=="pa_detail")
$ret.=HtmlInput::submit('export_analytic_axis',_("Export CSV"));
$ret.='</form>';
$ret.=HtmlInput::button_anchor(_('Efface ce plan'), '', 'remove_analytic_plan',
'onclick="return confirm_box(\'remove_analytic_plan\',\'Effacer ?\',function () {window.location=\'do.php?ac='.$_REQUEST['ac'].'&pa_id='.$_GET['pa_id'].'&sa=pa_delete&'.$str_dossier.'\';})"',
'onclick="return confirm_box(\'remove_analytic_plan\',\'Effacer ?\',function () {window.location=\'do.php?ac='.$http->request('ac').'&pa_id='.$http->get('pa_id','number').'&sa=pa_delete&'.$str_dossier.'\';})"',
'smallbutton');
$ret.='</div>';

View file

@ -93,7 +93,7 @@ if ( $low_action == "list" )
?>
<input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
<input type="hidden" name="ac" value="<?php echo $_REQUEST['ac']?>">
<input type="hidden" name="ac" value="<?php echo $http->request('ac')?>">
</form>
</div>
<?php

View file

@ -31,7 +31,7 @@ if (!defined('ALLOWED'))
*
* ***************************************************************************** */
$tabs=new Html_Tab("tg", _("Etiquette"));
$http=new \HttpInput();
ob_start();
$tag=new Tag($cn);
$uos=new Single_Record('tag');
@ -64,7 +64,7 @@ if (isset($_POST['save_tag_sb']))
</p>
<?php
$tag->show_list();
$js=sprintf("onclick=\"show_tag('%s','%s','%s','p')\"", Dossier::id(), $_REQUEST['ac'], '-1');
$js=sprintf("onclick=\"show_tag('%s','%s','%s','p')\"", Dossier::id(), $http->request('ac'), '-1');
echo HtmlInput::button("tag_add", "Création étiquette", $js);
?>
</div>

View file

@ -634,6 +634,7 @@ class Acc_Account_Ledger
*/
static function HtmlTableHeader($actiontarget="poste")
{
$http=new \HttpInput();
switch($actiontarget)
{
case 'poste':
@ -651,13 +652,13 @@ class Acc_Account_Ledger
echo "<table >";
echo '<TR>';
$str_ople=(isset($_REQUEST['ople']))?HtmlInput::hidden('ople',$_REQUEST['ople']):'';
$str_ople=(isset($_REQUEST['ople']))?HtmlInput::hidden('ople',$http->request('ople')):'';
if ($actiontarget=='poste')
{
echo '<TD><form method="GET" ACTION="export.php">'.
dossier::hidden().
HtmlInput::submit('bt_other',"Autre poste").
$hid->input("type","poste").$hid->input('ac',$_REQUEST['ac'])."</form></TD>";
$hid->input("type","poste").$hid->input('ac',$http->request('ac'))."</form></TD>";
}
$id=uniqid("pdf_");
@ -668,21 +669,21 @@ class Acc_Account_Ledger
HtmlInput::hidden('act',$action_pdf).
$hid->input("type","poste").$str_ople.
$hid->input('p_action','impress').
$hid->input("from_periode",$_REQUEST['from_periode']).
$hid->input("to_periode",$_REQUEST['to_periode'])
$hid->input("from_periode",$http->request('from_periode')).
$hid->input("to_periode",$http->request('to_periode'))
;
if ( isset($_REQUEST['letter'] )) echo HtmlInput::hidden('letter','2');
if ( isset($_REQUEST['solded'] )) echo HtmlInput::hidden('solded','1');
if (isset($_REQUEST['from_poste']))
echo HtmlInput::hidden('from_poste',$_REQUEST['from_poste']);
echo HtmlInput::hidden('from_poste',$http->request('from_poste'));
if (isset($_REQUEST['to_poste']))
echo HtmlInput::hidden('to_poste',$_REQUEST['to_poste']);
echo HtmlInput::hidden('to_poste',$http->request('to_poste'));
if (isset($_REQUEST['poste_id']))
echo HtmlInput::hidden("poste_id",$_REQUEST['poste_id']);
echo HtmlInput::hidden("poste_id",$http->request('poste_id'));
if (isset($_REQUEST['poste_fille']))
echo $hid->input('poste_fille','on');
@ -697,17 +698,17 @@ class Acc_Account_Ledger
HtmlInput::hidden('act',$action_csv).
$hid->input("type","poste").$str_ople.
$hid->input('p_action','impress').
$hid->input("from_periode",$_REQUEST['from_periode']).
$hid->input("to_periode",$_REQUEST['to_periode']);
$hid->input("from_periode",$http->request('from_periode')).
$hid->input("to_periode",$http->request('to_periode'));
if (isset($_REQUEST['from_poste']))
echo HtmlInput::hidden('from_poste',$_REQUEST['from_poste']);
echo HtmlInput::hidden('from_poste',$http->request('from_poste'));
if (isset($_REQUEST['to_poste']))
echo HtmlInput::hidden('to_poste',$_REQUEST['to_poste']);
echo HtmlInput::hidden('to_poste',$http->request('to_poste'));
if (isset($_REQUEST['poste_id']))
echo HtmlInput::hidden("poste_id",$_REQUEST['poste_id']);
echo HtmlInput::hidden("poste_id",$http->request('poste_id'));
if ( isset($_REQUEST['letter'] )) echo HtmlInput::hidden('letter','2');
if ( isset($_REQUEST['solded'] )) echo HtmlInput::hidden('solded','1');
@ -716,7 +717,7 @@ class Acc_Account_Ledger
echo $hid->input('poste_fille','on');
if (isset($_REQUEST['oper_detail']))
echo $hid->input('oper_detail','on');
if (isset($_REQUEST['poste_id'])) echo $hid->input("poste_id",$_REQUEST['poste_id']);
if (isset($_REQUEST['poste_id'])) echo $hid->input("poste_id",$http->request('poste_id'));
echo "</form></TD>";
echo '<td style="vertical-align:top">';

View file

@ -22,12 +22,13 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/database/jrn_def_sql.class.php';
require_once NOALYSS_INCLUDE.'/database/operation_currency_sql.class.php';
/** \file
/**
* \file
* @brief Class for jrn, class acc_ledger for manipulating the ledger
*/
/**
* @class
* @class Acc_Ledger
* @brief Class for jrn, class acc_ledger for manipulating the ledger AND some acc. operations
*
*/
@ -45,6 +46,7 @@ class Acc_Ledger extends jrn_def_sql
/**
* @brief construct
* @param $p_cn database connexion
* @param $p_id jrn.jrn_def_id
*/
@ -896,7 +898,7 @@ class Acc_Ledger extends jrn_def_sql
$add_js="";
if ($g_parameter->MY_PJ_SUGGEST !='N')
{
$add_js="update_pj();";
$add_js="update_receipt();";
}
if ($g_parameter->MY_DATE_SUGGEST=='Y')
{

View file

@ -311,7 +311,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
if ($g_parameter->MY_DATE_SUGGEST=='Y')
$onchange.='get_last_date();';
if ($g_parameter->MY_PJ_SUGGEST=='Y')
$onchange.='update_pj();';
$onchange.='update_receipt();';
$add_js='onchange="'.$onchange.'"';
$wLedger=$this->select_ledger('FIN', 2, FALSE);

View file

@ -38,7 +38,7 @@ abstract class Acc_Ledger_History
public $db; //!< database connx
protected $ledger_type; //! type of ledger VEN , ACH , ODS, FIN
protected $filter_operation; //!< to filter paid, unpaid or all operation
protected $data; // Contains data see acc_ledger_history_financial->get_row
/**
*
* @param Database $cn

View file

@ -33,7 +33,7 @@
class Acc_Ledger_History_Generic extends Acc_Ledger_History
{
private $data; //!< array of rows
/**
* Constructor

View file

@ -32,8 +32,6 @@
class Acc_Ledger_History_Purchase extends Acc_Ledger_History
{
private $data;//!< Contains rows from SQL
/**
* @param mixed $data
*/

View file

@ -31,8 +31,7 @@
class Acc_Ledger_History_Sale extends Acc_Ledger_History
{
private $data; //!< Contains rows from SQL
public function __construct(\Database $cn, $pa_ledger, $p_from, $p_to,
$p_mode)

View file

@ -19,27 +19,32 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
/*!
* \file
* \brief class for the purchase, herits from acc_ledger
*/
require_once NOALYSS_INCLUDE.'/lib/user_common.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
/*!\brief Handle the ledger of purchase,
/*!
* \class Acc_Ledger_Purchase
* \brief Handle the ledger of purchase,
*
*
*/
class Acc_Ledger_Purchase extends Acc_Ledger
{
private $payment_operation; /*<! id of the payment , set in insert */
function __construct ($p_cn,$p_init)
{
$this->ledger_type='ACH';
parent::__construct($p_cn,$p_init);
$this->payment_operation=-1;
}
/*!\brief verify that the data are correct before inserting or confirming
/*!
* \brief verify that the data are correct before inserting or confirming
*\param an array (usually $_POST)
*\return String
*\throw Exception if an error occurs
@ -472,7 +477,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}
}
/*!\brief insert into the database, it calls first the verify function
/*!
* \brief insert into the database, it calls first the verify function
* change the value of this->jr_id and this->jr_internal.
* It generates the document and save the middle of payment, if 'gen_invoice is set
* and e_mp
@ -548,19 +554,36 @@ class Acc_Ledger_Purchase extends Acc_Ledger
try
{
bcscale(4);
// total amount of the purchase
// variable : $tot_amount float : total amount of the purchase (debit)
$tot_amount=0;
// variable : $tot_tva float : total amount of the VAT
$tot_tva=0;
$tot_debit=0;
$this->db->start();
// variable : $tot_nd float total not Deductible
$tot_nd=0;
// variable : $tot_perso float total private amount
$tot_perso=0;
// variable : $tot_tva_nd float total vat not deductible
$tot_tva_nd=0;
// variable : $tot_tva_ndded float total vat not deductible - deductible via another tax
$tot_tva_ndded=0;
$tot_tva_reversed=0;
$tot_tva_reversed=0; //@todo to remove
// variable : $tva array that will contain all the VAT Amount
$tva=array();
// variable : $tva_reverse array that contain all the VAT autoreverse AND negative
$tva_reverse = array();
// variable : $tot_amount_cur : total amount in currency
$tot_amount_cur=0;
// find the currency from v_currency_last_value
// variable : $currency_rate_ref Acc_Currency , currency object for this operation
$currency_rate_ref=new Acc_Currency($this->db, $p_currency_code);
/* Save all the items without vat and no deductible vat and expense*/
@ -571,7 +594,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
/* First we save all the items without vat */
$fiche=new Fiche($this->db);
$fiche->get_by_qcode(${"e_march".$i});
$tva_both=0;
// variable : $tva_both integer 1 for autoreverse ,0 normal, fetch it once for this item,
$tva_both=0;
/* tva */
if ($g_parameter->MY_TVA_USE=='Y')
{
@ -676,13 +700,14 @@ class Acc_Ledger_Purchase extends Acc_Ledger
if ( $g_parameter->MY_TVA_USE=='Y')
{
$tva_item=$acc_amount->amount_vat;
if (isset($tva[$idx_tva]))
{
$tva[$idx_tva]=(isset( $tva[$idx_tva]))? $tva[$idx_tva]:0;
if ($tva_both == 0 || $tva_item >= 0){
$tva[$idx_tva]=bcadd($tva[$idx_tva], $tva_item);
}else {
// $tva_item < 0 && $tva_both == 1
$tva_reverse[$idx_tva]=(isset($tva_reverse[$idx_tva]))?$tva_reverse[$idx_tva]:0;
$tva_reverse[$idx_tva]=bcadd($tva_item,$tva_reverse[$idx_tva]);
}
else
$tva[$idx_tva]=$tva_item;
}
/* Save the stock */
/* if the quantity is < 0 then the stock increase (return of
@ -853,8 +878,6 @@ class Acc_Ledger_Purchase extends Acc_Ledger
foreach ($tva as $i => $value)
{
$oTva=Acc_Tva::build($this->db,$i);
$oTva->load();
$poste_vat=$oTva->get_side('d');
$cust_amount=round(bcadd($tot_amount,$tot_tva),2);
@ -867,12 +890,15 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$acc_operation->type='d';
$acc_operation->periode=$tperiode;
if ( $value > 0 ) $tot_debit=bcadd($tot_debit,abs($value));
if ( $oTva->get_parameter("both_side") == 1 && $value ==0 ) continue;
$acc_operation->insert_jrnx();
// if TVA is on both side, we deduce it immediately
if ( $oTva->get_parameter("both_side")==1 )
{
$poste_vat=$oTva->get_side('c');
// $x temp variable is the tva_reverse_account and will be used to check $poste_vat
$x=$oTva->get_parameter("tva_reverse_account");
$poste_vat =(trim($x??"")=="")? $oTva->get_side('c'):$x;
if ( $poste_vat == '#')
{
$poste_vat=$oTva->get_side('d');
@ -880,16 +906,54 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$acc_operation=new Acc_Operation($this->db);
$acc_operation->date=$e_date;
$acc_operation->poste=$poste_vat;
$acc_operation->amount=$tot_tva_reversed;
$acc_operation->amount=$value;
$acc_operation->grpt=$seq;
$acc_operation->jrn=$p_jrn;
$acc_operation->type='c';
$acc_operation->periode=$tperiode;
$acc_operation->insert_jrnx();
if ( $value < 0 ) $tot_debit=bcadd($tot_debit,abs($value));
//if ( $value < 0 ) $tot_debit=bcadd($tot_debit,abs($value));
}
}
} // LOOP : foreach $tva
foreach ($tva_reverse as $i => $value) {
$oTva = Acc_Tva::build($this->db,$i);
$poste_vat = $oTva->get_side('d');
if ( $poste_vat == '#')
{
$poste_vat=$oTva->get_side('c');
}
$acc_operation = new Acc_Operation($this->db);
$acc_operation->date = $e_date;
$acc_operation->poste = $poste_vat;
$acc_operation->amount = $value;
$acc_operation->grpt = $seq;
$acc_operation->jrn = $p_jrn;
$acc_operation->type = 'd';
$acc_operation->periode = $tperiode;
$acc_operation->insert_jrnx();
// if TVA is on both side, we deduce it immediately
$poste_vat = $oTva->get_side('c');
if ( $poste_vat == '#')
{
$poste_vat=$oTva->get_side('d');
}
$acc_operation = new Acc_Operation($this->db);
$acc_operation->date = $e_date;
$acc_operation->poste = $poste_vat;
$acc_operation->amount = $value;
$acc_operation->grpt = $seq;
$acc_operation->jrn = $p_jrn;
$acc_operation->type = 'c';
$acc_operation->periode = $tperiode;
$acc_operation->insert_jrnx();
$tot_debit = bcadd($tot_debit, $value);
$tot_debit = round($tot_debit, 2);
$n_both = $value;
} //LOOP: foreach $tva_reverse
}
/* insert into jrn */
@ -1015,7 +1079,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$acc_pay->grpt=$acseq;
$acc_pay->jrn=$mp->get_parameter('ledger_target');
$acc_pay->periode=$tperiode;
$acc_pay->type=($famount>=0)?'d':'c';
$acc_pay->type=($famount>=0)?'d':'c';
$let_other=$acc_pay->insert_jrnx();
// insert into operation_currency
@ -1057,11 +1121,11 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$r1=$this->get_id($internal);
$r2=$this->get_id($acinternal);
/*
* add lettering
*/
$oletter=new Lettering($this->db);
$oletter->insert_couple($let_client,$let_other);
/*
* add lettering
*/
$oletter=new Lettering($this->db);
$oletter->insert_couple($let_client,$let_other);
/* set the flag paid */
$Res=$this->db->exec_sql("update jrn set jr_rapt='paid' where jr_id=$1",array($r1));
@ -1225,7 +1289,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$add_js="";
if ( $g_parameter->MY_PJ_SUGGEST !='N')
{
$add_js="update_pj();";
$add_js="update_receipt();";
}
if ($g_parameter->MY_DATE_SUGGEST == 'Y')
{
@ -1518,7 +1582,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
/* if we suggest the pj n# the run the script */
if ( $g_parameter->MY_PJ_SUGGEST !='N')
{
$r.='<script> update_pj();</script>';
$r.='<script> update_receipt();</script>';
}
// set focus on date
$r.= create_script("$('".$Date->id."').focus()");

View file

@ -300,21 +300,28 @@ class Acc_Ledger_Sale extends Acc_Ledger {
bcscale(4);
try {
// total amount of the sales (credit)
// variable : $tot_amount : total amount of the sales (credit)
$tot_amount = 0;
// total amount of the VAT
// variable : $tot_tva : total amount of the VAT
$tot_tva = 0;
// tot debit if item's amount < 0
$tot_debit = 0;
// total amount in currency
// variable : $tot_amount_cur : total amount in currency
$tot_amount_cur=0;
$this->db->start();
// variable : $tva array that will contain all the VAT Amount
$tva = array();
// variable : $tva_reverse array that contain all the VAT autoreverse AND negative
$tva_reverse = array();
// find the currency from v_currency_last_value
// variable : $currency_rate_ref Acc_Currency , currency object for this operation
$currency_rate_ref=new Acc_Currency($this->db, $p_currency_code);
/* Save all the items without vat */
for ($i = 0; $i < $nb_item; $i++) {
// variable : $n_both float auto-reverse amount
$n_both = 0;
if ( empty(${'e_march'.$i}) || empty(${'e_quant'.$i}) ) continue;
@ -328,7 +335,6 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$tot_amount = bcadd($tot_amount, $amount);
$tot_amount = round($tot_amount, 2);
if ( DEBUGNOALYSS > 1 ) { echo __LINE__." tot_amount $tot_amount<br>";}
$acc_operation = new Acc_Operation($this->db);
$acc_operation->date = $e_date;
$sposte = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
@ -367,39 +373,44 @@ class Acc_Ledger_Sale extends Acc_Ledger {
if ($g_parameter->MY_TVA_USE == 'Y') {
/* Compute sum vat */
$oTva = Acc_Tva::build($this->db, trim(${'e_march' . $i . '_tva_id'}));
$oTva->load();
$idx_tva =$oTva->get_parameter("id");
// variable : $auto_reverse = if the oTVA autoreverse, fetch it once for this item,
$auto_reverse=$oTva->get_parameter("both_side");
$tva_item_currency = ${'e_march' . $i . '_tva_amount'};
/* if empty then we need to compute it */
if (trim($tva_item_currency) == '' || ${'e_march'.$i.'_tva_amount'} == 0) {
/* retrieve tva */
$l = Acc_Tva::build($this->db, $idx_tva);
$l->load();
$tva_item_currency = bcmul($amount, $l->get_parameter('rate'));
$tva_item=round($tva_item_currency,2);
$tva_item_currency = bcmul($amount, $oTva->get_parameter('rate'));
$tva_item=round($tva_item_currency,2);
}
$tva_item=bcdiv($tva_item_currency,$p_currency_rate);
$tva_item=round($tva_item,2);
if (isset($tva[$idx_tva]))
$tva[$idx_tva]=(isset($tva[$idx_tva]))?$tva[$idx_tva]:0;
if ( $auto_reverse == 0)
{
$tva[$idx_tva]=bcadd($tva_item,$tva[$idx_tva]);
$tva[$idx_tva]=round($tva[$idx_tva],2);
$tot_tva = bcadd($tva_item, $tot_tva);
$tot_tva = round($tot_tva, 2);
}
else
{
$tva[$idx_tva]=$tva_item;
}
if ($oTva->get_parameter("both_side") == 0) {
$tot_tva = bcadd($tva_item, $tot_tva);
$tot_tva = round($tot_tva, 2);
} else {
$n_both = $tva_item;
$tva_item_currency = 0;
if ($n_both<0)
{
$tot_debit=round(bcadd($tot_debit, abs($n_both)),2);
$tva_reverse[$idx_tva]=(isset($tva_reverse[$idx_tva]))?$tva_reverse[$idx_tva]:0;
$tva_reverse[$idx_tva]=bcadd($tva_item,$tva_reverse[$idx_tva]);
$tva_reverse[$idx_tva]=round($tva_reverse[$idx_tva],2);
} else {
$tva[$idx_tva]=bcadd($tva_item,$tva[$idx_tva]);
$tva[$idx_tva]=round($tva[$idx_tva],2);
}
}
}
@ -548,20 +559,16 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$operation_currency->j_id=$let_tiers ;
$operation_currency->insert();
/** save all vat
/**************************************************************************************************
* save all vat
* $i contains the tva_id and value contains the vat amount
* if if ($g_parameter->MY_TVA_USE == 'Y' )
*/
************************************************************************************************** */
if ($g_parameter->MY_TVA_USE == 'Y') {
if ( DEBUGNOALYSS > 1 ) {
var_dump($tva);
}
foreach ($tva as $i => $value) {
$oTva = Acc_Tva::build($this->db,$i);
$oTva->load();
$poste_vat = $oTva->get_side('c');
$cust_amount = bcadd($tot_amount, $tot_tva);
@ -578,14 +585,16 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$tot_debit=bcadd($tot_debit, abs($value));
$tot_debit=round($tot_debit, 2);
}
if ( $oTva->get_parameter("both_side") == 1 && $value ==0 ) continue;
$acc_operation->insert_jrnx();
if ( DEBUGNOALYSS > 1 ) {
echo __LINE__." tot_tva $tot_tva<br>";
}
// if TVA is on both side, we deduce it immediately
if ($oTva->get_parameter("both_side") == 1) {
$poste_vat = $oTva->get_side('d');
if ($oTva->get_parameter("both_side") == 1 ) {
// $x temp variable is the tva_reverse_account and will be used to check $poste_vat
$x=$oTva->get_parameter("tva_reverse_account");
$poste_vat =(trim($x??"")=="")? $oTva->get_side('d'):$x;
if ($poste_vat == '#') $poste_vat=$oTva->get_side('c');
$cust_amount = bcadd($tot_amount, $tot_tva);
$acc_operation = new Acc_Operation($this->db);
$acc_operation->date = $e_date;
@ -600,7 +609,52 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$tot_debit = round($tot_debit, 2);
$n_both = $value;
}
}
foreach ($tva_reverse as $i => $value) {
$oTva = Acc_Tva::build($this->db,$i);
$poste_vat = $oTva->get_side('c');
if ( $poste_vat == '#')
{
$poste_vat=$oTva->get_side('d');
}
$acc_operation = new Acc_Operation($this->db);
$acc_operation->date = $e_date;
$acc_operation->poste = $poste_vat;
$acc_operation->amount = $value;
$acc_operation->grpt = $seq;
$acc_operation->jrn = $p_jrn;
$acc_operation->type = 'c';
$acc_operation->periode = $tperiode;
if ($value<0)
{
$tot_debit=bcadd($tot_debit, abs($value));
$tot_debit=round($tot_debit, 2);
}
$acc_operation->insert_jrnx();
// if TVA is on both side, we deduce it immediately
$poste_vat = $oTva->get_side('d');
if ( $poste_vat == '#')
{
$poste_vat=$oTva->get_side('c');
}
$acc_operation = new Acc_Operation($this->db);
$acc_operation->date = $e_date;
$acc_operation->poste = $poste_vat;
$acc_operation->amount = $value;
$acc_operation->grpt = $seq;
$acc_operation->jrn = $p_jrn;
$acc_operation->type = 'd';
$acc_operation->periode = $tperiode;
$acc_operation->insert_jrnx();
$tot_debit = bcadd($tot_debit, $value);
$tot_debit = round($tot_debit, 2);
$n_both = $value;
}
} // if ($g_parameter->MY_TVA_USE=='Y')
/*
* Balance the amount on D and C , the difference must be inserted as "difference due to a rounded value"
@ -1366,7 +1420,7 @@ EOF;
/* if we suggest the next pj, then we need a javascript */
$add_js = "";
if ($g_parameter->MY_PJ_SUGGEST != 'N') {
$add_js = "update_pj();";
$add_js = "update_receipt();";
}
if ($g_parameter->MY_DATE_SUGGEST == 'Y') {
$add_js.='get_last_date();';

View file

@ -35,10 +35,10 @@ class Acc_Ledger_Search
protected $cn; //!< Database Connection
private $type; //!< type of ledger : FIN,ODS,VEN,ACH
private $all; //!< Flag to indicate if all ledgers must searched (1 for yes)
private $div; //! prefix for id of DOM id
//! id of the ledger
var $id ;
private $all; //!< Flag to indicate if all ledgers must be searched (1 for yes)
private $div; //!< prefix for id of DOM id
var $id ; //!< id of the ledger
/**
* @brief return a HTML string with the form for the search
* @param $p_type if the type of ledger possible values=ALL,VEN,ACH,ODS,FIN: uppercase !
@ -47,9 +47,9 @@ class Acc_Ledger_Search
* - 1 means all the ledger of this type
* - 0 No have the "Tous les journaux" availables
* @param $div is the div (for reconciliation)
* @param type $p_type
* @param type $p_all
* @param type $p_div
* @param string $p_type ACH, VEN , ODS or FIN
* @param int $p_all 1 means all the ledger
* @param string $p_div prefix of the DOM ID
*
* @todo the parameter $all_type_ledger is useless : ALL means all the ledgers, VEN all the ledger of sales...
*/
@ -258,7 +258,7 @@ class Acc_Ledger_Search
}
/**
* Build the button for managing the filter for search
* @brief Build the button for managing the filter for search
* @param type $p_div id prefix of the div, button, table ..
* @param $this->type if the type of ledger possible values=ALL,VEN,ACH,ODS,FIN
* @param $all_type_ledger

View file

@ -860,9 +860,12 @@ EOF;
$cn=Dossier::connect();
$g_user=new Noalyss_user($cn);
$a=new Acc_Operation($cn);
$a->jr_id=1444;
$a->jr_id=993;
$b=$a->get_quant();
echo h1('contain of get_quant() ');
var_dump($b);
echo h1('contain of get_jrnx_detail()');
var_dump($a->get_jrnx_detail());
}
/**
* Return a select object to choose the type of operation

View file

@ -25,7 +25,7 @@
*/
/*!
* \class
* \class Acc_Operation_Note
* \brief Manage the note attached to an operation
*/

View file

@ -41,13 +41,17 @@ class Acc_Tva
"comment"=>"tva_comment",
"account"=>"tva_poste",
"both_side"=>'tva_both_side',
'tva_code');
'tva_reverse_account'=>'tva_reverse_account',
'tva_code'=>'tva_code');
public $tva_id,
$tva_label,
$tva_rate,
$tva_comment,
$tva_poste,
$tva_both_side,$tva_code;
$tva_both_side,
$tva_code,
$tva_reverse_account;
private $cn; //!< Database connection
private Tva_Rate_SQL $tva_rate_sql;
@ -63,6 +67,7 @@ class Acc_Tva
$this->tva_poste=&$this->tva_rate_sql->tva_poste;
$this->tva_both_side=&$this->tva_rate_sql->tva_both_side;
$this->tva_code=&$this->tva_rate_sql->tva_code;
$this->tva_reverse_account=&$this->tva_rate_sql->tva_reverse_account;
}
/**
@ -90,7 +95,7 @@ class Acc_Tva
return $this->$idx;
}
echo (__FILE__.":".__LINE__.'Erreur attribut inexistant');
echo (__FILE__.":".__LINE__."AT97:Erreur attribut inexistant [$p_string]");
}
public function set_parameter($p_string,$p_value)
{

View file

@ -40,7 +40,7 @@ class Admin extends Fiche
var $vat_number; /*!< $vat_number vat number */
/*! \brief Constructor
/* only a db connection is needed */
* only a db connection is needed */
function __construct($p_cn,$p_id=0)
{
$this->fiche_def_ref=FICHE_TYPE_ADM_TAX;

View file

@ -717,16 +717,15 @@ EOF;
return $result;
}
/**
* Save the ND VAT with prorata
* @brief Save the ND VAT in ANL, and distribute the amount among ANL Axis proportionnaly to the source
*
* @param $p_array usually $_POST
* @param $p_item item of the form
* @param $p_j_id jrnx.j_id concerned writing
* @param $p_nd amount nd vat
* @see Anc_Operation::save_form_plan_vat_nd
* @return type
* @param $p_array array usually $_POST
* @param $p_item int nb of the item of the form
* @param $p_j_id int jrnx.j_id concerned writing
* @param $p_nd float amount nd vat
* @see Anc_Operation::save_form_plan()
*/
function save_form_plan_vat_nd($p_array,$p_item,$p_j_id,$p_nd)
function save_form_plan_vat_nd($p_array,$p_item,$p_j_id,$p_nd):void
{
bcscale(4);
extract($p_array, EXTR_SKIP);
@ -734,18 +733,16 @@ EOF;
if ( ! isset(${'amount_t'.$p_item}) )
throw new Exception ('amount not set');
$tot=0;
/* variable for in array
pa_id array of existing pa_id
hplan double array with the pa_id (column)
val double array by row with amount
op contains sequence
p_item is used to identify what op is concerned
/**
* variable for in array
* @var pa_id array of existing pa_id
@var hplan double array with the pa_id as key (column)
@var val double array by row with amount
* @var op contains sequence
@var p_item is used to identify what op is concerned
*/
/* echo "j_id = $j_id p_item = $p_item hplan=".var_export($hplan[$p_item],true)." val = ".var_export($val[$p_item],true).'<br>'; */
/* for each row */
// for ($i=0;$i<count($val[$p_item]);$i++) {
$idx_pa_id=0;
$row=0;
$a_Anc_Operation=array();
@ -782,21 +779,12 @@ EOF;
$idx_pa_id++;
}
$nb_op=count($a_Anc_Operation);
bcscale(4);
for ($i=0;$i<$nb_op;$i++)
{
$tot=bcadd($tot,$a_Anc_Operation[$i]->oa_amount);
}
// utilité ???
// if ( $tot != $p_nd && count($a_Anc_Operation) > 0 )
// {
// $diff= bcsub($tot, $p_nd);
// $a_Anc_Operation[0]->oa_amount=bcsub($a_Anc_Operation[0]->oa_amount,$diff);
// }
for ($i=0;$i<$nb_op;$i++)
{
$a_Anc_Operation[$i]->add();
}
}
/*!\brief it called for each item, the data are taken from $p_array
* data and set before in this. Amount will be transformed thanks the $this->currency_rate;

View file

@ -185,7 +185,7 @@ class Anc_Plan
function exist()
{
$a=$this->db->count_sql("select pa_id from plan_analytique where pa_id=$1",
array($this->pa_id));
array($this->id));
return ($a==0)?false:true;
@ -193,7 +193,7 @@ class Anc_Plan
/**
*@brief return an HTML string containing hidden input type to
* hold the differant PA_ID
*@param $p_array contains a array, it is the result of the fct
*@param $p_array array contains a array, it is the result of the fct
* Anc_Plan::get_list
*@return html string
*@see Anc_Plan::get_list

View file

@ -25,7 +25,7 @@
*
*/
/**
* @class
* @class Anticipation
* @brief Manage the anticipation of expense, sales,...
* @see Forecast Forecast_Cat Forecast_Item
*

View file

@ -39,8 +39,7 @@ class Bank extends Fiche
var $cp; /*!< $cp Zip code */
var $vat_number; /*!< $vat_number vat number */
/*! \brief Constructor
/* only a db connection is needed */
/*! \brief Constructor only a db connection is needed */
function __construct($p_cn,$p_id=0)
{
$this->fiche_def_ref=FICHE_TYPE_FIN;

View file

@ -5,7 +5,7 @@
*
*/
/**
* @class
* @class Card_PDF
* @brief Class Card_PDF
*/
class Card_PDF extends \PDF

View file

@ -39,7 +39,8 @@ class Customer extends Fiche
var $vat_number; /*!< $vat_number vat number */
/*! \brief Constructor
/* only a db connection is needed */
* only a db connection is needed
*/
function __construct($p_cn,$p_id=0)
{
$this->fiche_def_ref=FICHE_TYPE_CLIENT;

View file

@ -27,21 +27,24 @@
/**
* @class Document_Type
*@brief class for the table document_type , a document_type is a kind of action in the follow up
*
* < dt_id pk document_type
* < dt_value value
*/
class Document_Type
{
/** document_type
* \brief constructor
* \param $p_cn database connx
*/
var $db; //!< Database Connection
var $dt_id; //!< primary key see SQL DOCUMENT_TYPE.DT_ID
var $dt_value; //!< description of the document see SQL DOCUMENT_TYPE.DT_VALUE
var $dt_prefix; //!< prefix for numbering see SQL DOCUMENT_TYPE.DT_PREFIX
function __construct($p_cn, $p_id = -1)
/**
* \brief
* \brief constructor document_type
* \param $p_cn database connx
* \param $dt_id primary key see SQL DOCUMENT_TYPE.DT_ID
*/
function __construct(\Database $p_cn, int $dt_id = -1)
{
$this->db = $p_cn;
$this->dt_id = $p_id;
$this->dt_id = $dt_id;
}
/**
@ -51,9 +54,9 @@ class Document_Type
function get()
{
$sql = "select * from document_type where dt_id=$1";
$R = $this->db->exec_sql($sql, array($this->dt_id));
if ($this->db->count($R) == 0) return 1;
$r = Database::fetch_array($R, 0);
$r = $this->db->get_row($sql, array($this->dt_id));
if ( $r == null ) return 1;
$this->dt_id = $r['dt_id'];
$this->dt_value = $r['dt_value'];
$this->dt_prefix = $r['dt_prefix'];
@ -72,6 +75,7 @@ class Document_Type
$array = array();
for ($i = 0; $i < count($r); $i++)
{
$tmp=array();
$tmp['dt_value'] = $r[$i]['dt_value'];
$tmp['dt_prefix'] = $r[$i]['dt_prefix'];
@ -99,7 +103,7 @@ class Document_Type
* Restart the increment of the document
* @param type $p_int
*/
function set_number($p_int)
function set_number(int $p_int)
{
try
{
@ -107,8 +111,74 @@ class Document_Type
}
catch (Exception $e)
{
record_log($e);
alert("Erreur " . $e->getMessage());
}
}
function __toString(): string
{
return sprintf("dt_id : [%d] \n dt_value [%s] \n dt_prefix [%s]\n",$this->dt_id,$this->dt_value,$this->dt_prefix);
}
/**
* @brief unit test for Document_Type
* @return void
*/
static function test_me()
{
// if (! defined('TEST_UNIT')) return;
$cn=Dossier::connect();
function prv_echo_error($msg,int $lineno) {
print '<p class="p-2 alert-danger">';
print "ERROR : $lineno";
print $msg;
print '</p>';
}
// prepare test
$old_value=[];
try {
$cn->start();
$old_value[0]=$cn->get_row('select * from document_type where dt_id=$1',[8]);
$old_value[1]=$cn->get_row('select * from document_type where dt_id=$1',[6]);
$cn->exec_sql("update document_type set dt_value='Email' where dt_id=$1",[6]);
$cn->exec_sql("update document_type set dt_prefix='PML' where dt_id=$1",[8]);
$document_type=new Document_Type($cn,8);
echo $document_type;
if ( $document_type->get() == 1 ) {
}
if ( $document_type->dt_prefix!='PML') {
prv_echo_error("PREFIX :". $document_type,__LINE__);
}
$document_type->set_number(6);
$document_type->get();
if ( $document_type->dt_value!='Email') {
prv_echo_error("VALUE :". $document_type,__LINE__);
}
$list=Document_Type::get_list($cn);
// list array > 1 and key =5
if (count ($list) == 0) {
prv_echo_error("GET_LIST :EMPTY",__LINE__);
} else {
foreach (['js_mod','dt_id','dt_value','dt_prefix','js_remove'] as $key) {
if ( ! isset ($list[0][$key])) {
prv_echo_error ('NOT SET '.$key,__LINE__);
} else {
echo '<pre>';
var_dump( $list[0][$key]);
echo '</pre>';
}
}
}
} catch (\Exception $e) {
prv_echo_error("EXCEPTION :". $document_type,__LINE__);
print_r($e->getTraceAsString());
}
$cn->rollback();
}
}

View file

@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/lib/user_common.php';
*/
/**
* \class
* \class Follow_Up
* \brief class_action for manipulating actions
* action can be :
* <ul>

View file

@ -20,11 +20,13 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/* !\file
/*!
*\file
* \brief letter the accounting entry (row level)
*/
/**
* @class
* @brief mother class for the lettering by account and by card
* use the tables jnt_letter, letter_deb and letter_cred
* - "account"=>"account", => the accounting of the j_id (use by Lettering_Account)
@ -32,7 +34,14 @@
* - "start"=>"start", => date of the first day
* - "end"=>"end", => date of the last day
* - "sql_ledger"=>"sql_ledger" => the sql clause to filter on the available ledgers
*
* @see unit-test/include/class/acc_letterTest.php
* @see test scenario scenario/XML/ajax_display_letter.php
*/
#[\AllowDynamicProperties]
class Lettering
{
@ -50,6 +59,7 @@ class Lettering
var $sql_ledger;
var $object_type;
var $content;
/**
* constructor
* @param $p_init resource to database
@ -351,7 +361,7 @@ class Lettering
}
/**
* show only the lettered records from jrnx
* @brief show only the lettered records from jrnx
* it fills the array $this->content
*/
protected function show_lettered()
@ -366,7 +376,7 @@ class Lettering
}
/**
* show only the lettered records from jrnx
* @brief show only the lettered records from jrnx
* it fills the array $this->content
*/
protected function show_lettered_diff()
@ -381,7 +391,7 @@ class Lettering
}
/**
* show only the not lettered records from jrnx
* @brief show only the not lettered records from jrnx
* it fills the array $this->content
*/
protected function show_not_lettered()
@ -479,8 +489,12 @@ class Lettering
}
/**
* only for operation retrieved thanks a account (jrnx.j_poste)
*@class
* @brief only for operation retrieved thanks a account (jrnx.j_poste)
* manage the accounting entries for a given account
*
* @see unit-test/include/class/acc_letterTest.php
*
*/
class Lettering_Account extends Lettering
{
@ -493,7 +507,7 @@ class Lettering_Account extends Lettering
}
/**
* fills the this->content, datas are filtered thanks
* @brief fills the this->content, datas are filtered thanks
* - fil_deb poss values t (debit), f(credit), ' ' (everything)
* - fil_amount_max max amount
* - fil_amount_min min amount
@ -548,7 +562,7 @@ class Lettering_Account extends Lettering
}
/**
* fills this->content with all the operation for the this->account(jrnx.j_poste)
* @brief fills this->content with all the operation for the this->account(jrnx.j_poste)
*/
public function get_all()
{
@ -577,7 +591,7 @@ class Lettering_Account extends Lettering
}
/**
* same as get_all but only for lettered operation
* @brief same as get_all but only for lettered operation
*/
public function get_letter()
{
@ -606,7 +620,7 @@ class Lettering_Account extends Lettering
}
/**
* same as get_all but only for lettered operation
*@brief same as get_all but only for lettered operation
*/
public function get_letter_diff()
{
@ -637,7 +651,7 @@ class Lettering_Account extends Lettering
}
/**
* same as get_all but only for unlettered operation
*@brief same as get_all but only for unlettered operation
*/
public function get_unletter()
{
@ -663,7 +677,8 @@ class Lettering_Account extends Lettering
}
/**
* only for operation retrieved thanks a quick_code
* @class
* @brief only for operation retrieved thanks a quick_code
* manage the accounting entries for a given card
*/
class Lettering_Card extends Lettering
@ -683,7 +698,7 @@ class Lettering_Card extends Lettering
}
/**
* fills the this->content, datas are filtered thanks
*@brief fills the this->content, datas are filtered thanks
* - fil_deb poss values t (debit), f(credit), ' ' (everything)
* - fil_amount_max max amount
* - fil_amount_min min amount
@ -743,7 +758,7 @@ class Lettering_Card extends Lettering
}
/**
* fills this->content with all the operation for the this->quick_code(j_qcode)
* @brief fills this->content with all the operation for the this->quick_code(j_qcode)
*/
public function get_all()
{
@ -773,7 +788,7 @@ class Lettering_Card extends Lettering
}
/**
* same as get_all but only for lettered operation
* @brief same as get_all but only for lettered operation
*/
public function get_letter()
{
@ -801,6 +816,10 @@ class Lettering_Card extends Lettering
$this->content=$this->db->get_array($sql, array($this->quick_code, $this->start, $this->end));
}
/**
* @brief lettered operation with a different amount
* @return void
*/
public function get_letter_diff()
{
$sql="
@ -829,7 +848,7 @@ class Lettering_Card extends Lettering
}
/**
* same as get_all but only for unlettered operation
* @brief same as get_all but only for unlettered operation
*/
public function get_unletter()
{
@ -852,7 +871,7 @@ class Lettering_Card extends Lettering
}
/**
* fill $this->content with the rows from this query
* @brief fill $this->content with the rows from this query
* Columns are
* - j_id, id of jrnx
* - j_date, date opeation (yyyy.mm.dd)

View file

@ -41,7 +41,7 @@ class Manager extends Fiche
var $vat_number; /*!< $vat_number vat number */
/*! \brief Constructor
/* only a db connection is needed */
* only a db connection is needed */
function __construct($p_cn,$p_id=0)
{
$this->fiche_def_ref=FICHE_TYPE_EMPL;

View file

@ -25,7 +25,7 @@
*/
/**
* @class
* @class Noalyss_Appearance
* @brief Contains some parameters to change appearance of noalyss, the colors are saved
* into the table parm_appearance
*/
@ -35,7 +35,7 @@ class Noalyss_Appearance
'MENU1' => '#000074',
'BODY' => '#ffffff',
'MENU2' => '#3d3d87',
'MENU1-SELECTED' => '#7191ea',
'MENU1-SELECTED' => '#000074',
'TR-ODD'=>'#DCE7F5',
'TR-EVEN'=>'#ffffff',
'INNER-BOX'=>'#DCE1EF',
@ -170,9 +170,7 @@ class Noalyss_Appearance
.nav-pills .nav-link {
color: {$menu1_font} !important;
}
.nav-link:hover {
background-color:{$menu1_selected};
}
table.sortable, table.table_large, table.result ,table.resultfooter {
color:{$font_table} !important;
}

View file

@ -23,7 +23,7 @@
*/
/**
* @class
* @class Operation_Opening
* @brief Operation ouverture
*/
class Operation_Opening extends Operation_Exercice

View file

@ -100,15 +100,21 @@ EOF;
function is_closed()
{
if ($this->jrn_def_id!=0)
{
$sql="select status from jrn_periode ".
" where jrn_def_id=".$this->jrn_def_id.
" and p_id =".$this->p_id;
" where jrn_def_id=$2 ".
" and p_id = $1";
$status=$this->cn->get_value($sql,[$this->p_id,$this->jrn_def_id]);
}
else
{
$sql="select p_closed as status from parm_periode ".
" where ".
" p_id =".$this->p_id;
$res=$this->cn->exec_sql($sql);
$status=Database::fetch_result($res, 0, 0);
" p_id = $1";
$status=$this->cn->get_value($sql,[$this->p_id]);
}
if ($status=='CL'||$status=='t'||$status=='CE')
return 1;
return 0;

View file

@ -518,7 +518,7 @@ class Pre_operation
}
/*!
@class
@class Pre_operation_detail
@brief mother of the pre_op_XXX, it contains only one data : an
* object Pre_Operation. The child class contains an array of
* Pre_Operation object

View file

@ -39,7 +39,7 @@ class Supplier extends Fiche
var $vat_number; /*!< $vat_number vat number */
/*! \brief Constructor
/* only a db connection is needed */
* only a db connection is needed */
function __construct($p_cn,$p_id=0)
{
$this->fiche_def_ref=FICHE_TYPE_FOURNISSEUR;

View file

@ -136,26 +136,45 @@ class Tax_Summary
)
";
$cnt=$this->db->get_value($sql, [$this->date_start, $this->date_end]);
if ($cnt==0)
$cnt_ledger=$this->db->get_value("
select count(*) from jrnx
where
jrnx.j_jrn_def in (select jrn_def_id from jrn_def where jrn_def_type = 'VEN')
and j_date >= to_date($1,'DD.MM.YYYY')
and j_date <= to_date($2,'DD.MM.YYYY')
", [$this->date_start, $this->date_end]);
if ($cnt==0 && $cnt_ledger !=0)
{
throw new Exception(_("Données manquantes"),100);
throw new Exception('TX148:'._("Données manquantes"),100);
}
/* -------------Purchase --------------------------------- */
$sql="select count(*)
from
quant_purchase
where
j_id in (select j_id from jrnx
where
jrnx.j_jrn_def in (select jrn_def_id from jrn_def where jrn_def_type = 'VEN')
jrnx.j_jrn_def in (select jrn_def_id from jrn_def where jrn_def_type = 'ACH')
and j_date >= to_date($1,'DD.MM.YYYY')
and j_date <= to_date($2,'DD.MM.YYYY')
)
";
$cnt=$this->db->get_value($sql, [$this->date_start, $this->date_end]);
if ($cnt>0)
$cnt_ledger=$this->db->get_value("
select count(*) from jrnx
where
jrnx.j_jrn_def in (select jrn_def_id from jrn_def where jrn_def_type = 'ACH')
and j_date >= to_date($1,'DD.MM.YYYY')
and j_date <= to_date($2,'DD.MM.YYYY')
", [$this->date_start, $this->date_end]);
if ($cnt ==0 && $cnt_ledger !=0)
{
throw new Exception(_("Données manquantes"),100);
throw new Exception('TX175'._("Données manquantes"),100);
}
}
private function build_exigibility()

View file

@ -79,7 +79,8 @@ class Todo_List
}
if ( strcmp ($p_idx, 'tl_date') == 0 )
{
if ( noalyss_strlentrim($p_value) ==0 ||strlen($p_value) > 12 || isDate ($p_value) == false) return false;
if ( noalyss_strlentrim($p_value) ==0 ||strlen($p_value) > 12 || isDate ($p_value) == false)
{ $p_value = null;return true;}
}
if ( strcmp ($p_idx, 'tl_title') == 0 )
{
@ -113,7 +114,7 @@ class Todo_List
{
if ( isDate($this->tl_date) == false )
{
$this->tl_date=date('d.m.Y');
$this->tl_date=null;
}
return 0;
}
@ -129,7 +130,7 @@ class Todo_List
{
if ( $this->verify() != 0 ) return;
if (trim($this->tl_title)=='')
$this->tl_title=mb_substr(trim($this->tl_desc),0,30);
$this->tl_title=mb_substr(trim($this->tl_desc??""),0,30);
if (trim($this->tl_title)=='')
{
@ -142,6 +143,12 @@ class Todo_List
$sql="insert into todo_list (tl_date,tl_title,tl_desc,use_login,is_public) ".
" values (to_date($1,'DD.MM.YYYY'),$2,$3,$4,$5) returning tl_id";
if ($this->tl_date == null) {
$sql="insert into todo_list (tl_date,tl_title,tl_desc,use_login,is_public) ".
" values ($1,$2,$3,$4,$5) returning tl_id";
}
$res=$this->cn->exec_sql(
$sql,
array($this->tl_date,
@ -172,6 +179,11 @@ class Todo_List
$sql="update todo_list set tl_title=$1,tl_date=to_date($2,'DD.MM.YYYY'),tl_desc=$3,is_public=$5 ".
" where tl_id = $4";
if ($this->tl_date == null) {
$sql="update todo_list set tl_title=$1,tl_date=$2,tl_desc=$3,is_public=$5 ".
" where tl_id = $4";
}
$res=$this->cn->exec_sql(
$sql,
array($this->tl_title,
@ -296,7 +308,7 @@ class Todo_List
}
/**
* Display the note
* @brief Display the note
* @return html string
*/
function display()

View file

@ -36,7 +36,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
//!< previous tva_id, used to know if we update or insert,
private $previous_id;
private $a_comment; //!< Supplemental explanation
/**
*
@ -52,15 +52,18 @@ class Tva_Rate_MTable extends Manage_Table_SQL
$this->set_col_label("tva_rate", _("taux"));
$this->set_col_label("tva_comment", _("Description"));
$this->set_col_label("tva_both_side", _("Autoliquidation"));
$this->set_col_label("tva_reverse_account", _('Poste comptable autoliquidation'));
$this->set_col_label("tva_sale", _("TVA Vente (C)"));
$this->set_col_label("tva_purchase", _("TVA Achat (D)"));
$this->set_property_visible('tva_reverse_account', false);
$this->set_col_type("tva_both_side", "select",
array(
["value"=>0, "label"=>_("Non")],
["value"=>1, "label"=>_("Oui")]
));
$this->set_col_type("tva_reverse_account", 'custom');
$this->set_property_updatable("tva_id", true);
$this->set_col_label("tva_payment_purchase",_("Exigible achat"));
$this->set_col_type("tva_payment_purchase","select",
@ -76,9 +79,18 @@ class Tva_Rate_MTable extends Manage_Table_SQL
array("value"=>'P',"label"=>"Paiement")
)
);
$this->a_info=["tva_purchase"=>44,"tva_both_side"=>43,"tva_sale"=>45
,"tva_payment_sale"=>74,"tva_payment_purchase"=>74];
$this->a_info=[
"tva_purchase"=>44,"tva_both_side"=>43,"tva_sale"=>45
,"tva_payment_sale"=>74,"tva_payment_purchase"=>74,'tva_reverse_account'=>88];
$this->previous_id=null;
$this->a_comment=array(
'tva_purchase'=>_("Ne donnez pas ce poste comptable si ce code n'est pas utilisé à l'achat"),
'tva_both_side'=>_("Autoliquidation : Utilisé en même temps au crédit et au débit"),
'tva_sale'=>_("Ne donnez pas ce poste comptable si ce code n'est pas utilisé à la vente"),
'tva_payment_purchase'=>_('TVA due ou récupérable quand l\'opération est payée ou exécutée'),
'tva_payment_sale'=>_('TVA due ou récupérable quand l\'opération est payée ou exécutée'),
'tva_reverse_account'=>_("Forcer ce poste comptable pour autoliquidation : par défault, le poste d'autoliquidation est calculé : soit celui qui est en contrepartie, soit le même (voir manuel)")
);
}
/**
@ -107,6 +119,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
function input()
{
$nb_order=count($this->a_order);
$this->set_property_visible('tva_reverse_account', true);
echo "<table>";
for ($i=0; $i<$nb_order; $i++)
{
@ -181,6 +194,16 @@ class Tva_Rate_MTable extends Manage_Table_SQL
echo $inum->input();
echo \HtmlInput::hidden("old_tva_id",$value);
} elseif ($key=='tva_reverse_account')
{
$text=new IPoste("tva_reverse_account");
$text->value=$value;
$min_size=10;
$text->set_attribute('gDossier', Dossier::id());
$text->set_attribute('jrn', 0);
$text->set_attribute('account', 'tva_reverse_account');
$text->size=$min_size;
echo $text->input();
}
echo "</td>";
}
@ -190,12 +213,28 @@ class Tva_Rate_MTable extends Manage_Table_SQL
HtmlInput::hidden($key, $value)
);
}
echo '<td class="text-muted">';
if (isset ($this->a_comment[$key])) {
echo $this->a_comment[$key];
}
echo '</td>';
}
echo "</tr>";
}
echo "</table>";
}
/**
* @brief add the TVA_REVERSE_ACCOUNT
* @return void
*/
function from_request()
{
parent::from_request();
$http=new \HttpInput();
$this->table->tva_reverse_account=$http->request('tva_reverse_account');
}
/**
* @brief save the data in TVA_RATE
* if tva_both_side is 1 and tva_purchase or tva_sale is empty then
@ -230,6 +269,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
$tva_rate->setp("tva_label", $this->table->tva_label);
$tva_rate->setp("tva_comment", $this->table->tva_comment);
$tva_rate->setp("tva_both_side", $this->table->tva_both_side);
$tva_rate->setp("tva_reverse_account", $this->table->tva_reverse_account);
// TVA accounting must be joined and separated with a comma
$tva_purchase=(trim($this->table->tva_purchase)=="")?"#":$this->table->tva_purchase;
@ -249,7 +289,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
}
/**
* Check data are valid
* @brief Check data are valid
* 1. tva_rate between 0 & 1
* 2. label is uniq
* 3. accounting must exist
@ -340,6 +380,26 @@ class Tva_Rate_MTable extends Manage_Table_SQL
if (isNumber($this->table->tva_code) == 1){
$this->set_error("tva_code", _("code tva : doit aussi contenir des lettres"));
}
/**
* auto reverse VAT : check that the accounting is used
*/
if ( $this->table->tva_both_side==0 && trim($this->table->tva_reverse_account??"") != "")
{
$this->set_error("tva_reverse_account", _("Pas d'autoliquidation demandé"));
}
if ( $this->table->tva_both_side==1 && trim($this->table->tva_reverse_account??"") != "")
{
$count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val = $1",
[$this->table->tva_reverse_account]);
if ($count==0)
{
$this->set_error("tva_reverse_account", _("Poste comptable inexistant"));
}
}
// label cannot be empty
if ( trim($this->table->tva_label??"")=="") {
$this->set_error("tva_label", _('Le label ne peut être vide'));
}
if ($this->count_error()!=0)
return false;
return true;

View file

@ -321,7 +321,7 @@ echo Icon_Action::tips($anc_filter->title);
<div class="form-group">
<label class="w-20" for="p_alphanum">
<?= _('Utilisez des postes comptables alphanumérique') ?>
<?= _('Utilisez des postes comptables alphanumériques') ?>
</label>
<?= $alpha_num->input('p_alphanum') ?>
</div>

View file

@ -302,7 +302,7 @@ echo '<div class="content">';
/* if we suggest the pj n# the run the script */
if ( $g_parameter->MY_PJ_SUGGEST=='Y')
{
echo '<script> update_pj()</script>';
echo '<script> update_receipt()</script>';
}
$e_date=$http->request("e_date","string","");

View file

@ -28,7 +28,7 @@ global $version_noalyss;
define('NOALYSS_VERSION', 9300 );
// Database schema version
define("DBVERSION", 202);
define("DBVERSION", 203);
// version for MONO_DATABASE
define("MONO_DATABASE", 25);

View file

@ -27,8 +27,8 @@
*/
/**
* @class
* @brief abstract of the table
* @class Operation_Exercice_Detail_SQL
* @brief abstract of the table operation_exercice_detail
*/
class Operation_Exercice_Detail_SQL extends Table_Data_SQL
{

View file

@ -51,6 +51,7 @@ class Tva_Rate_SQL extends Table_Data_SQL
,"tva_payment_purchase"=>"tva_payment_purchase"
,"tva_payment_sale"=>"tva_payment_sale"
,"tva_code"=>"tva_code"
,'tva_reverse_account'=>'tva_reverse_account'
);
/*
* Type of columns
@ -65,6 +66,7 @@ class Tva_Rate_SQL extends Table_Data_SQL
,"tva_payment_purchase"=>"text"
,"tva_payment_sale"=>"text"
,"tva_code"=>"text"
,'tva_reverse_account'=>'text'
);

View file

@ -49,6 +49,7 @@ class V_Tva_Rate_SQL extends Table_Data_SQL
, "tva_purchase"=>"tva_purchase"
, "tva_sale"=>"tva_sale"
, "tva_both_side"=>"tva_both_side"
,'tva_reverse_account'=>'tva_reverse_account'
,'tva_payment_purchase'=>'tva_payment_purchase'
,'tva_payment_sale'=>'tva_payment_sale'
@ -65,6 +66,7 @@ class V_Tva_Rate_SQL extends Table_Data_SQL
, "tva_purchase"=>"text"
, "tva_sale"=>"text"
, "tva_both_side"=>"numeric"
,'tva_reverse_account'=>'text'
, 'tva_payment_purchase'=>'text'
, 'tva_payment_sale'=>'text'
);

View file

@ -35,7 +35,7 @@
[from_poste] =>
[to_poste] =>
)
@encode
@endcode
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');

View file

@ -1,54 +0,0 @@
<?php
//This file is part of NOALYSS and is under GPL
//see licence.txt
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/constant.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
require_once NOALYSS_INCLUDE.'/constant.security.php';
echo '<div class="topmenu">';
@html_page_start($_SESSION[SESSION_KEY.'g_theme']);
$cn=Dossier::connect();
global $g_user;
$g_user=new Noalyss_user($cn);
$g_user->check();
$only_plugin=$g_user->check_dossier(dossier::id());
/* javascript file */
echo load_all_script();
/* show all the extension we can access */
$a=new ISelect('plugin_code');
$a->value=Extension::make_array($cn);
$a->selected=(isset($_REQUEST['plugin_code']))?strtoupper($_REQUEST['plugin_code']):'';
/* no plugin available */
if ( count($a->value) == 0 )
{
alert(j(_("Aucune extension disponible")));
exit;
}
/* only one plugin available then we don't propose a choice*/
if ( count($a->value)==1 )
{
$_REQUEST['plugin_code']=$a->value[0]['value'];
}
echo '</div>';
/*else
{
if (!isset($_REQUEST['ac'])) echo_warning ("ac non positionné");
echo '<form method="get" action="do.php">';
echo Dossier::hidden();
echo HtmlInput::request_to_hidden(array('plugin_code','ac'));
echo _('Extension').$a->input().HtmlInput::submit('go',_("Choix de l'extension"));
echo '</form>';
echo '<hr>';
}*/
//if ( isset($_REQUEST['plugin_code']))
// require_once NOALYSS_INCLUDE.'/extension_get.inc.php';
?>

View file

@ -1,7 +1,29 @@
<?php
//This file is part of NOALYSS and is under GPL
//see licence.txt
/*
* 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(2004) Dany De Bontridder danydb@aevalys.eu
/*!
* \file
* \brief lettering : included from include/category_card.inc.php, which is part of manager.inc.php, customer.inc.php,...
*
* some variable are already defined ($cn, $g_user ...)
*/
Noalyss\Dbg::echo_file(__FILE__);
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
global $g_user;
echo '<div class="content">';
@ -22,13 +44,13 @@ $periode=new Periode($cn);
list($first_per,$last_per)=$periode->get_limit($exercice);
$start=new IDate('start');
$start->value=(isset($_GET['start']))?$http->get('start'):$first_per->first_day();
$start->value=(isset($_GET['start']))?$http->get('start','date'):$first_per->first_day();
$r=td(_('Date début'));
$r.=td($start->input());
echo tr($r);
$end=new IDate('end');
$end->value=(isset($_GET['end']))?$_GET['end']:$last_per->last_day();
$end->value=(isset($_GET['end']))?$http->get('end','date'):$last_per->last_day();
$r=td(_('Date fin'));
$r.=td($end->input());
echo tr($r);
@ -52,7 +74,7 @@ echo '<br>';
echo HtmlInput::submit("seek",_('Recherche'));
echo '</FORM>';
echo '</div>';
//if (! isset($_REQUEST['seek'])) exit;
echo '<hr>';
//--------------------------------------------------------------------------------
// record the data
@ -74,7 +96,7 @@ if ( isset($_GET['start']) && isset($_GET['end']))
}
}
echo '<div id="list">';
$fiche=new Fiche($cn,$_REQUEST['f_id']);
$fiche=new Fiche($cn, $http->request('f_id',"number"));
$quick_code=$fiche->get_quick_code();
$letter=new Lettering_Card($cn);
$letter->set_parameter('quick_code',$quick_code);

View file

@ -36,9 +36,9 @@ function h($p_string)
{
return ( $p_string === null)?"":htmlspecialchars($p_string,ENT_QUOTES|ENT_HTML5,'UTF-8',true);
}
function p($p_string)
function p($p_string, $p_extra='')
{
return '<p>'.$p_string."</p>";
return '<p '.$p_extra.'>'.$p_string."</p.>";
}
function span($p_string, $p_extra='')
{
@ -1800,4 +1800,5 @@ function sanitize_filename($filename)
$new_filename=strtolower($filename_no)."-".date("Ymd-Hi").$filename_suff;
return $new_filename;
}
}

View file

@ -2784,7 +2784,9 @@ EOF;
echo js_include('acc_currency.js');
echo js_include('taggroup.js');
echo js_include('noalyss_checkbox.js');
if (DEBUGNOALYSS > 1) {
echo js_include('noalyss_debug.js');
}
}
/**

View file

@ -172,7 +172,7 @@ class HttpInput
}
if (!array_key_exists($p_name,$this->array))
{
throw new Exception(_('Paramètre invalide')."[$p_name]",
throw new Exception("C175."._('Paramètre invalide')."[$p_name]",
EXC_PARAM_VALUE);
}
$this->check_type($p_name, $p_type);

View file

@ -476,7 +476,7 @@ class ICard extends HtmlInput
}
$input='<div class="d-none d-lg-inline">'.
Icon_Action::clean_zone(uniqid("remove"),"$('{$this->id}').value=''").
Icon_Action::clean_zone(uniqid("remove"),"clean_Fid('{$this->id}');compute_all_ledger();").
"</div>";
$input.=sprintf('

View file

@ -28,7 +28,7 @@
* value , either 1 or 0 EXPERIMENTAL
*/
/**
* @class
* @class InputCheckBox
* @brief modern checkbox, using a javascript to change the icon when clicked and a hidden field, there is always a
* value , either 1 or 0 , EXPERIMENTAL
*/

View file

@ -88,12 +88,12 @@ class IPoste extends HtmlInput
$this->extra2="all";
$this->extra="";
$this->attribute=array();
$this->id=$p_id;
$this->id=$p_id;
$this->nb_row=1;
}
static function ipopup($p_name)
static function ipopup($p_name)
{
$ip=new IPopup($p_name);
$ip->title='Plan comptable';

View file

@ -218,7 +218,7 @@ class Manage_Table_SQL
*/
function send_header()
{
header('Content-type:text/xml;charset="UTF-8"');
@header('Content-type:text/xml;charset="UTF-8"');
}
/**

View file

@ -121,4 +121,6 @@ content[84]="<?php echo htmlspecialchars(_("En Belgique, l'exercice commence par
content[85]="<?php echo htmlspecialchars(_("Solde créditeur au lieu de débiteur"),ENT_QUOTES)?>";
content[86]="<?php echo htmlspecialchars(_("Solde débiteur au lieu de créditeur"),ENT_QUOTES)?>";
content[87]="<?php echo htmlspecialchars(_("Uniquement pour les choix, séparer les valeurs possibles par un |"),ENT_QUOTES)?>";
content[88]="<?php echo htmlspecialchars(_("Par défault, le poste d'autoliquidation est celui qui est au débit pour les ventes et au crédit pour les achats"),ENT_QUOTES)?>";
</script>

View file

@ -77,11 +77,16 @@ class Noalyss_Csv
}
/***
*@brief Send an header for CSV , the filename is corrected
*@brief Send an header for CSV , the filename is corrected. If TEST_UNIT is defined, the function is called
* from a test file (located in scenario , see manual )and no header are requested
*/
function send_header()
{
$this->correct_name();
if ( defined('TEST_UNIT')) {
return;
}
header('Pragma: public');
header('Content-type: application/csv');
header("Content-Disposition: attachment;filename=\"{$this->filename}\"",
@ -292,5 +297,32 @@ class Noalyss_Csv
$this->size = $size;
return $this;
}
/**
* @brief convert CSV strings (content of a file) into HTML table,
* @param $string CSV files
*/
static function csv2table ($string)
{
$a_field=[';',','];
$sep_field=$a_field[$_SESSION[SESSION_KEY.'csv_fieldsep']];
$a_field=['.',','];
$sep_dec=$a_field[$_SESSION[SESSION_KEY.'csv_decimal']];
$encoding=$_SESSION[SESSION_KEY.'csv_encoding'];
$aRow=explode("\r\n", $string);
echo '<table class="result">';
foreach ($aRow as $row) {
echo '<tr>';
$aCol=explode($sep_field, $row);
foreach ($aCol as $col) {
echo '<td>';
echo h($col);
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
}
}

View file

@ -23,7 +23,61 @@
/**
* @file
* @brief Display the tabs
*
* @code
* // create TAQ , with a url
$tab = new Html_Tab('tab1',_("Titre 1"));
$tab->set_mode('link');
$tab->set_link("test.php?".
http_build_query([ "gDossier"=>Dossier::id(),
"script"=>"html_tab.test.php",
"a"=>1,
"b"=>2]));
*
// create a TAB and give the content
$tab2 = new Html_Tab('tab2',_("Titre 2"));
$tab2->set_content(""
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2"
. "<br> Très longue chaine HTML pour 2");
$tab3 = new Html_Tab('tab3',_("Titre 3"));
$tab3->set_content('<p >'
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
. "<br> Très longue chaine HTML pour 3"
.'</p>'
);
$output = new Output_Html_Tab;
$output->add($tab);
$output->add($tab2);
$output->add($tab3);
// show all the TABS
$output->output();
*
* @endcode
*/
/**

View file

@ -65,7 +65,7 @@ class PDF_Core extends TFPDF
private $cells=array();
protected $bigger;
public function __construct ( $orientation = 'P', $unit = 'mm', $format = 'A4')
{
$this->bigger=0;

View file

@ -1,268 +0,0 @@
<?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 The opening of the exercices. it takes the saldo of the
* choosen foolder / exercice and import it as a misc operation in the
* current folder
*
*
*
*/
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
$http=new HttpInput();
$p_mesg="";
$sa=$http->request("sa", "string", "");
$g_user->Check();
require_once NOALYSS_INCLUDE.'/lib/user_menu.php';
// Correct (last step)
if (isset($_POST['correct']))
{
$p_jrn=$http->request("p_jrn", "number");
$ledger=new Acc_Ledger($cn, $p_jrn);
require_once NOALYSS_INCLUDE.'/operation_ods_new.inc.php';
return;
}
// confirm before saving
if (isset($_POST['summary']))
{
try
{
$p_jrn=$http->request("p_jrn", "number");
$ledger=new Acc_Ledger($cn, $p_jrn);
$ledger->with_concerned=false;
$ledger->verify($_POST);
require_once NOALYSS_INCLUDE.'/operation_ods_confirm.inc.php';
}
catch (Exception $e)
{
echo alert($e->getMessage());
require(NOALYSS_INCLUDE.'/operation_ods_new.inc.php');
}
return;
}
// record
if (isset($_POST['save']))
{
$p_jrn=$http->request("p_jrn", "number");
$array=$_POST;
$ledger=new Acc_Ledger($cn, $p_jrn);
$ledger->with_concerned=false;
try
{
$ledger->save($array);
$jr_id=$cn->get_value('select jr_id from jrn where jr_internal=$1',
array($ledger->internal));
echo '<h2>'._("Opération enregistrée")." "._("Piece ").h($ledger->pj).'</h2>';
if (strcmp($ledger->pj, $_POST['e_pj'])!=0)
{
echo '<h3 class="notice">'._('Attention numéro pièce existante, elle a du être adaptée').'</h3>';
}
printf('<a class="detail" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a><hr>',
$jr_id, dossier::id(), $ledger->internal);
// show feedback
echo '<div id="jrn_name_div">'; echo '<h1 id="jrn_name" style="display:inline">'.$ledger->get_name().'</h1>'; echo '</div>';
echo $ledger->confirm($_POST, true);
}
catch (Exception $e)
{
require(NOALYSS_INCLUDE.'/operation_ods_new.inc.php');
alert($e->getMessage());
}
return;
}
/* --------------------------------------------------
* step 1 if nothing is asked we show the available folders
*/
if ($sa=='')
{
echo '<div class="content">';
echo '<h1 class="legend">'._("Etape 1 : choix du dossier").' </h1>';
echo _('Choisissez le dossier où sont les soldes à importer');
$avail=$g_user->get_available_folder();
if (empty($avail))
{
echo '*** '._("Aucun dossier").' ***';
return;
}
echo '<form class="print" method="post">';
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('sa', 'step2');
echo dossier::hidden();
$wAvail=new ISelect();
/* compute select list */
$array=array();
$i=0;
foreach ($avail as $r)
{
$array[$i]['value']=$r['dos_id'];
$array[$i]['label']=$r['dos_name'];
$i++;
}
$wAvail->selected=Dossier::id();
$wAvail->value=$array;
printf (_('Choix du dossier : %s'),
$wAvail->input('f'));
echo HtmlInput::submit('ok', _('Continuer'));
echo '</form>';
echo '</div>';
echo '</div>';
return;
}
/* --------------------------------------------------
* Step 2 choose now the exercice of this folder
*/
$back='do.php?ac='.$http->request("ac").'&'.dossier::get();
if ($sa=='step2')
{
echo '<div class="content">'.
'<div><h1 class="legend">'._('Etape 2 : période').'</h1>'.
'<h2 class="info">'.dossier::name($_REQUEST['f']).'</h2>'.
'<form class="print" method="post">'.
_("Choisissez l'exercice clôturé (exercice N-1) du dossier à reporter pour les a-nouveaux (exercice N)");
echo dossier::hidden();
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('sa', 'step3');
echo HtmlInput::hidden('f', $_REQUEST['f']);
$cn=new Database($_REQUEST['f']);
$periode=$cn->make_array("select distinct p_exercice,p_exercice from parm_periode order by p_exercice");
$w=new ISelect();
$w->table=0;
$w->label=_('Periode N-1');
$w->readonly=false;
$w->value=$periode;
$w->name="p_periode";
$w->selected=$g_user->get_exercice()-1;
echo "<p>";
echo _('Période N-1').' : '.$w->input();
echo "</p>";
echo HtmlInput::submit('ok', _('Continuer'));
echo dossier::hidden();
echo "</form>";
echo HtmlInput::button_anchor(_('Retour'), $back);
exit(0);
}
/* --------------------------------------------------
* select the ledger where we will import the data
*/
if ($sa=='step3')
{
echo '<div class="content">'.
'<div><h1 class="legend">Etape 3</h1>'.
'<h2 class="info">'.dossier::name($_REQUEST['f']).'</h2>'.
'<form class="print" method="post">'.
_(" Choisissez le journal qui contiendra l'opération d'ouverture ");
echo dossier::hidden();
echo HtmlInput::hidden('p_action', 'ouv');
echo HtmlInput::hidden('sa', 'step4');
echo HtmlInput::hidden('f', $_REQUEST['f']);
echo HtmlInput::hidden('p_periode', $_REQUEST['p_periode']);
$wLedger=new ISelect();
$g_user=new Noalyss_user($cn);
$avail=$g_user->get_ledger('ODS');
/* compute select list */
$array=array();
$i=0;
foreach ($avail as $r)
{
$array[$i]['value']=$r['jrn_def_id'];
$array[$i]['label']=$r['jrn_def_name'];
$i++;
}
$wLedger->value=$array;
echo $wLedger->input('p_jrn');
echo HtmlInput::submit('ok', 'Continuer');
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo dossier::hidden();
echo "</form>";
echo HtmlInput::button_anchor('Retour',
$back.'&sa=step2&f='.$_REQUEST['f']);
exit(0);
}
/* --------------------------------------------------
* Step 4 we import data from the selected folder and year and
* transform it into a misc operation
*/
if ($sa=='step4')
{
echo '<div class="content">';
echo '<div><h1 class="legend">'._("étape 4").'</h1>';
$dossier_id=$http->request("f","number");
$p_periode=$http->request("p_periode","number");
$p_jrn=$http->request("p_jrn","number");
$cn_target=new Database($dossier_id);
$saldo=new Acc_Ledger($cn_target, 0);
$array=$saldo->get_saldo_exercice($p_periode);
/* we need to transform the array into a Acc_Ledger array */
$result=array();
$result['desc']=sprintf(_("Ecriture d'ouverture %d"),$g_user->get_exercice());
$result['nb_item']=sizeof($array);
$result['p_jrn']=$p_jrn;
$result["ac"]=$http->request("ac");
$result['p_periode']=$p_periode;
$result['gDossier']=Dossier::id();
$result['jr_optype']="OPE";
// default date = first day of Exercice
$periode=new Periode($cn,$g_user->get_periode());
list($periode_start,$periode_end)=$periode->get_limit($g_user->get_exercice());
$result["e_date"]=$periode_start->first_day();
$idx=0;
foreach ($array as $row)
{
$qcode='qc_'.$idx;
$poste='poste'.$idx;
$amount='amount'.$idx;
$ck='ck'.$idx;
$result[$qcode]=$row['j_qcode'];
if (trim($row['j_qcode']??"")=='')
$result[$poste]=$row['j_poste'];
$result[$amount]=abs($row['solde']);
if ($row['solde']>0)
$result[$ck]='on';
$idx++;
}
$cn=Dossier::connect();
$jrn=new Acc_Ledger($cn,$p_jrn);
$_POST=$result;
$_REQUEST=$result;
$ledger=new Acc_Ledger($cn, $p_jrn);
require_once NOALYSS_INCLUDE.'/operation_ods_new.inc.php';
echo '</div>';
}

View file

@ -4,6 +4,7 @@ set search_path = public,comptaproc,pg_catalog ;
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
@ -43,7 +44,6 @@ SELECT pg_catalog.lo_create('2346476');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (800, 'Ajout de fiche', 'fiche', 'FICADD');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (805, 'Création, modification et effacement de fiche', 'fiche', 'FIC');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (910, 'création, modification et effacement de catégorie de fiche', 'fiche', 'FICCAT');

View file

@ -9,7 +9,7 @@ export TEMPLATE=${DOMAIN}mod1
psql -X $TEMPLATE -c "delete from user_local_pref"
psql -X $TEMPLATE -c "delete from user_local_pref"
pg_dump -O -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
pg_dump -Ox -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
sed -i -e "/COMMENT ON EXTENSION/d" schema.sql
sed -i -e "/CREATE EXTENSION/d" schema.sql
sed -ne '0,/ADD CONSTRAINT/p' schema.sql > tmpSchema.sql

View file

@ -3,6 +3,7 @@
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);

View file

@ -9,7 +9,7 @@ export TEMPLATE=${DOMAIN}mod2
psql -X $TEMPLATE -c "delete from user_local_pref"
psql -X $TEMPLATE -c "delete from user_local_pref"
pg_dump -O -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
pg_dump -Ox -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
sed -i -e "/COMMENT ON EXTENSION/d" schema.sql
sed -i -e "/CREATE EXTENSION/d" schema.sql
sed -ne '0,/ADD CONSTRAINT/p' schema.sql > tmpSchema.sql
@ -17,5 +17,5 @@ sed -ne '/ADD CONSTRAINT/,$p' schema.sql |sed -e '1d' > constraint.sql
cp tmpSchema.sql schema.sql
echo "set search_path = public,comptaproc,pg_catalog ;" > data.sql
pg_dump -O -U dany --data-only --column-inserts -O ${TEMPLATE}|sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql
pg_dump -Ox -U dany --data-only --column-inserts -O ${TEMPLATE}|sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql

View file

@ -0,0 +1,25 @@
begin;
alter table tva_rate add column tva_reverse_account account_type;
alter table tva_rate add constraint fk_tva_reverse_account foreign key (tva_reverse_account) references tmp_pcmn(pcm_val) on delete set null on update cascade ;
comment on column tva_rate.tva_reverse_account is 'Accouting for reversed VAT';
drop VIEW public.v_tva_rate;
CREATE OR REPLACE VIEW public.v_tva_rate
AS SELECT tva_id,
tva_rate,
tva_code,
tva_label,
tva_comment,
tva_reverse_account,
split_part(tva_poste, ','::text, 1) AS tva_purchase,
split_part(tva_poste, ','::text, 2) AS tva_sale,
tva_both_side,
tva_payment_purchase,
tva_payment_sale
FROM tva_rate;
insert into version (val,v_description) values (203,'C0TVA force accounting for autoreverse VAT');
commit;

View file

@ -1,6 +1,11 @@
<?php
//This file is part of NOALYSS and is under GPL
//see licence.txt
/**
* @var $str_anc String HTML contains the detail of analytic
* @var $g_user Noalyss_User inherited , it is the connected user
*/
$str_anc="";
global $div,$g_parameter,$cn,$access,$jr_id,$obj;
?><?php require_once NOALYSS_TEMPLATE.'/ledger_detail_top.php'; ?>
@ -270,7 +275,53 @@ global $div,$g_parameter,$cn,$access,$jr_id,$obj;
$str_anc.=td($poste);
$str_anc.=td(nbm($htva)." {$side}");
$str_anc.=$anc_op->display_table(1, $htva, $div);
}
$str_anc.='</tr>';
/* check there is no other row for this one like TVA_ND */
/**
* @var $anl_extra array of rows from operation_analytique concerning the current record
*
*/
$anl_extra=$cn->get_array('select distinct j1.f_id,
o1.j_id j_id_anx,
j1.j_poste,
j1.j_debit,
j1.j_montant
from operation_analytique o1
join jrnx j1 on (o1.j_id=j1.j_id)
where oa_jrnx_id_source = $1',
[$q['j_id']]);
if (count($anl_extra) > 0)
{
foreach ($anl_extra as $item_anl_extra) {
$anc_op = new Anc_Operation($cn);
$anc_op->j_id =$item_anl_extra['j_id_anx'];
$anc_op->in_div=uniqid();
$side=($item_anl_extra['j_debit'] == 'f')?'C':'D';
$n="";
if ( $item_anl_extra['f_id'] != "") {
$n=$cn->get_value('select ad_value from fiche_detail
where
f_id =$1
and ad_id=$2'
,[$item_anl_extra['f_id'],ATTR_DEF_QUICKCODE]);
}
/* compute total price */
bcscale(2);
$str_anc.='<tr>';
$str_anc.=td($n);
$str_anc.=td($item_anl_extra['j_poste']);
$str_anc.=td(nbm($item_anl_extra['j_montant'])." {$side}");
$str_anc.=$anc_op->display_table(0, $htva, $anc_op->in_div);
$str_anc.='</tr>';
}
}
}
}
$class=($e%2==0)?' class="even"':'class="odd"';
/*

View file

@ -1,10 +1,31 @@
<?php
//This file is part of NOALYSS and is under GPL
//This file is part of NOALYSS and is under GPL
//see licence.txt
/**
* Called from Acc_Ledger_Search
* @var $this Acc_Ledger_Search
* @var $f_ledger ICheckBox inherited Acc_Ledger_Search
* @var $hid_jrn html string : hidden r_jrn from previous request inherited
* @var $f_date_start IDate inherited
* @var $f_date_end IDate inherited
* @var $f_date_paid_start IDate inherited
* @var $f_date_paid_end IDate inherited
* @var $date_start_hidden IDate inherited
* @var $date_end_hidden IDate inherited
* @var $f_amount_min INum inherited
* @var $f_amount_max INum inherited
* @var $f_accounting IPoste inherited
* @var $g_parameter Noalyss_Parameter_Folder global variable
* @var $tva_id_search ITva_Popup inherited
* @var $f_paid ISelect inherited
* @var $sCurrency Acc_Currency inherited
* @var $http HttpInput inherited
*/
?>
<table id="<?=$this->div?>table_search">
<tr>
<td style="text-align:right;width:30em">
<?php echo _('Dans le journal')?>
@ -112,19 +133,19 @@ echo $f_accounting->input(); ?>
</tr>
<tr>
<td style="text-align:right;width:30em">
<?php
$iselect= new ISelect($this->div."tag_option");
$iselect->value=array(
array("value"=>0,"label"=>_("Toutes les étiquettes")),
array("value"=>1,"label"=>_("Au moins une étiquette"))
);
$iselect->set_value($http->request($this->div."tag_option","number",0));
echo $iselect->input();
echo $iselect->input();
?>
<?php
echo Tag_Operation::select_tag_search($this->div);
@ -132,7 +153,7 @@ echo $f_accounting->input(); ?>
</td>
<td >
<span id="<?=$this->div?>tag_choose_td">
<?php
<?php
$aTag= $http->request($this->div."tag","string",0);
if (is_array($aTag) ) {
$nb_tag=count($aTag);
@ -142,9 +163,9 @@ echo $f_accounting->input(); ?>
}
}
?>
</span>
</td>
</tr>
</table>

View file

@ -7,7 +7,7 @@
?><div class="">
<?php
if ($level == 0) {
echo '<ul class="nav nav-pills nav-fill flex-row noprint" >';
echo '<ul class="nav nav-pills nav-fill flex-row noprint nav-level0" >';
}elseif ($level == 1) {
echo '<ul class="nav nav-pills nav-level2 noprint">';

View file

@ -161,7 +161,7 @@ endif;
</TR>
<tr>
<td>
<?=_("Nombre de caractère du numéro de pièce, remplissage avec des 0 ")?>
<?=_("Nombre de chiffres du numéro de pièce, remplissage avec des 0 ")?>
</td>
<td>
<?=$padding->input()?>

View file

@ -17,7 +17,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/** \file
/**
* \file
* \brief included file for customizing with the vat (account,rate...)
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');

View file

@ -25,7 +25,7 @@
namespace Noalyss\Widget;
/*!
* \class
* \class Event
* \brief show 10 next events , or 10 late
*/

View file

@ -0,0 +1,71 @@
<?php
//@description: export export_histo_csv.php
$_GET=array (
'gDossier' => '25',
'ledger_type' => 'ALL',
'tag_option' => '0',
'act' => 'CSV:histo',
'viewsearch' => 'Export vers CSV',
'qcode' => '',
);
$_POST=array (
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
ob_start();
include NOALYSS_INCLUDE."/export/export_histo_csv.php";
$result=ob_get_contents();
ob_end_clean();
html_page_start();
if (trim($result) != '') {
echo p('result ok','class="alert-success"');
} else {
echo p('result failed','class="notice"');
}
echo h1('Tous les journaux');
\Noalyss_Csv::csv2table($result);
echo h1('Achat 01.01.2019 - 31.12.2019');
$_GET=array (
'date_paid_start' => '',
'date_paid_end' => '',
'date_start' => '01.01.2019',
'date_end' => '31.12.2019',
'desc' => '',
'amount_min' => '0',
'amount_max' => '0',
'operation_filter' => 'all',
'accounting' => '',
'gDossier' => '25',
'ledger_type' => 'ACH',
'search_optag_option' => '0',
'p_currency_code' => '-1',
'tva_id_search' => '',
'tag_option' => '0',
'act' => 'CSV:histo',
'viewsearch' => 'Export vers CSV',
'qcode' => '',
);
$_POST=array (
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
ob_start();
include NOALYSS_INCLUDE."/export/export_histo_csv.php";
$result=ob_get_contents();
ob_end_clean();
html_page_start();
if (trim($result) != '') {
echo p('result ok','class="alert-success"');
} else {
echo p('result failed','class="notice"');
}
csv2table($result);

View file

@ -19,14 +19,14 @@
*/
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
//@description:History : show different history : detail, list, ...
/**
* @file
* @brief Test of ledger_history
* @brief Test of ledger_history show html
*/
require_once NOALYSS_INCLUDE."/class/acc_ledger_history.class.php";
html_page_start();
$ledger=[1,2,3,4];
echo Dossier::hidden();
global $cn, $g_user, $g_succeed, $g_failed;
@ -35,13 +35,18 @@ $cn=Dossier::connect();
$ledger_history=Acc_Ledger_History::factory($cn, $ledger, $min, $max, "E","all");
echo h1("Detailled Accounting");
echo h2(_("export detail html all ledgers result = Detailled Accounting from Acc_Ledger_History_Generic"));
echo '<a href="#n1">Detailled Accounting</a>';
$ledger_history->export_detail_html();
echo h2(_("Set mode to D etailled all_ledgers result = Detailled Accounting from Acc_Ledger_History_Generic" ));
echo h2(_("Set mode to D etailled all_ledgers result = Detailled Accounting from Acc_Ledger_History_Generic" )
,'id="n1"');
echo '<a href="#n2">Sale Listing</a>';
$ledger_history->set_m_mode("D");
$ledger_history->export_html();
echo h1(_("Only VEN from Acc_Ledger_History_Sale"));
echo h1(_("Only VEN from Acc_Ledger_History_Sale"),' id="n2"');
echo '<a href="#n3">Sale Detailed</a>';
$ledger_history=Acc_Ledger_History::factory($cn, [2], $min , $max , "L","all");
$ledger_history->export_detail_html();
@ -49,46 +54,55 @@ echo h2(_("Only VEN one line"));
$ledger_history->set_a_ledger([2]);
$ledger_history->set_m_mode("L");
$ledger_history->export_html();
echo h2(_("Only VEN Detailled"));
echo h2(_("Only VEN Detailled"),'id="n3"');
echo '<a href="#n4">Sale Extended</a>';
$ledger_history->set_a_ledger([2]);
$ledger_history->set_m_mode("D");
$ledger_history->export_html();
echo h2(_("Only VEN Extended"));
echo h2(_("Only VEN Extended"),'id="n4"');
echo '<a href="#n5">Sale + Purchase</a>';
$ledger_history->set_a_ledger([2]);
$ledger_history->set_m_mode("E");
$ledger_history->export_html();
echo h2("VEN + ACH");
echo h2("VEN + ACH",'id="n5"');
echo '<a href="#n6">Purchase Detailed</a>';
$ledger_history=Acc_Ledger_History::factory($cn, [3,2], $min, $max , "L","all");
$ledger_history->export_oneline_html();
echo h1("ACH from Acc_Ledger_History_Purchase");
echo h2("Detailled accouting");
echo h2("Detailled accouting",'id="n6"');
echo '<a href="#n7">Purchase listing</a>';
$ledger_history=new Acc_Ledger_History_Purchase($cn,[3],$max,$min,"A","all");
$ledger_history->export_html();
echo h2("Ach one line");
echo h2("Ach one line",'id="n7"');
echo '<a href="#n8">Purchase Detailed</a>';
$ledger_history->set_m_mode("L");
$ledger_history->export_html();
echo h2("Ach Detail");
echo h2("Ach Detail" ,'id="n8"');
echo '<a href="#n9">Purchase Extended</a>';
$ledger_history->set_m_mode("D");
$ledger_history->export_html();
echo h2("Ach Extended");
echo h2("Ach Extended" ,'id="n9"');
echo '<a href="#n10">Financial</a>';
$ledger_history->set_m_mode("E");
$ledger_history->export_html();
echo h1("FIN from Acc_Ledger_History_Financial");
echo h2("Detailled accouting");
echo h2("Detailled accouting",'id="n10"');
echo '<a href="#n11">Financial one line</a>';
$ledger_history=new Acc_Ledger_History_Financial($cn,[11,16],$min,$max,"A","all");
$ledger_history->export_html();
echo h2("FIN one line");
echo h2("FIN one line" ,'id="n11"');
echo '<a href="#n12">Financial Detailed</a>';
$ledger_history->set_m_mode("L");
$ledger_history->export_html();
echo h2(">FIN Detail");
echo h2(">FIN Detail", 'id="n12"');
echo '<a href="#n13">Financial extended</a>';
$ledger_history->set_m_mode("D");
$ledger_history->export_html();
echo h2("FIN Extended");
echo h2("FIN Extended", 'id="n13"');
$ledger_history->set_m_mode("E");
$ledger_history->export_html();

View file

@ -0,0 +1,27 @@
<?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 20/12/24
/*!
* \file
* \brief Calls Acc_Operation::testme
*/
//@description:Acc_Operation calls the Acc_Operation::testme function
Acc_Operation::test_me();

View file

@ -1,5 +1,5 @@
<?php
//@description:ACH Appel menu Achat
//@description:ACH new purchase
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUACH/ACH',
@ -9,4 +9,8 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'compta_ach.inc.php';

View file

@ -6,7 +6,7 @@ $_GET=array (
);
$_POST=array (
'gDossier' => '42',
'e_client' => 'IMMOB',
'e_client' => 'FOURNI1',
'nb_item' => '1',
'p_jrn' => '3',
'e_comm' => 'Loyer',
@ -15,7 +15,7 @@ $_POST=array (
'jrn_type' => 'ACH',
'e_pj' => 'ACH1',
'e_pj_suggest' => 'ACH1',
'mt' => '1415995238.7737',
'mt' => '141599523a8.7737',
'e_mp' => '0',
'e_march0' => 'LOYER',
'e_march0_price' => '2560',
@ -28,8 +28,12 @@ $_POST=array (
'opd_name' => 'Paiement loyer',
'od_description' => 'Paiement du loyer',
'record' => 'Enregistrement',
'p_currency_rate'=>1 ,
'p_currency_code'=>'0'
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'compta_ach.inc.php';

View file

@ -10,13 +10,13 @@ $_POST=array (
'gDossier' => '42',
'nb_item' => '10',
'p_jrn' => '3',
'e_date' => '01.02.2016',
'e_date' => '01.02.2017',
'e_ech' => '',
'e_client' => 'DIV',
'e_client' => 'FOURNI1',
'e_pj' => 'ACH2',
'e_pj_suggest' => 'ACH2',
'e_comm' => 'Paiement loyer',
'e_march0' => 'FID15',
'e_march0' => 'LOYER',
'e_march0_label' => 'TEST',
'e_march0_price' => '2560.0000',
'e_quant0' => '1.0000',
@ -102,6 +102,8 @@ $_POST=array (
'sa' => 'p',
'e_mp' => '0',
'view_invoice' => 'Enregistrer',
'p_currency_rate'=>1 ,
'p_currency_code'=>'0'
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;

View file

@ -12,7 +12,7 @@ $_POST=array (
'p_jrn' => '3',
'e_date' => '01.01.2017',
'e_ech' => '',
'e_client' => 'IMMOB',
'e_client' => 'FOURNI1',
'e_pj' => 'ACH2',
'e_pj_suggest' => 'ACH2',
'e_comm' => 'Paiement loyer',
@ -99,6 +99,8 @@ $_POST=array (
'jrn_type' => 'ACH',
'e_mp' => '0',
'view_invoice' => 'Enregistrer',
'p_currency_rate'=>1 ,
'p_currency_code'=>'0'
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;

View file

@ -11,4 +11,5 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'compta_ach.inc.php';

View file

@ -1,5 +1,5 @@
<?php
//@description:ACHISTO
//@description:ACHISTO History Purchase
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUACH/ACHISTO',
@ -9,4 +9,5 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'history_operation.inc.php';

View file

@ -1,5 +1,5 @@
<?php
//@description:ODHISTO
//@description:ODHISTO : history Misc. Operation
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUODS/ODHISTO',
@ -10,4 +10,5 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'history_operation.inc.php';

Some files were not shown because too many files have changed in this diff Show more