New : 0002190: Journaux : option pour supprimer la quantité

This commit is contained in:
Dany De Bontridder 2022-09-03 22:32:08 +02:00 committed by sparkyx
parent 868d78a862
commit a08cbfa3dd
6 changed files with 95 additions and 7 deletions

View file

@ -313,7 +313,9 @@ $path = array(
// Mobile device menu from mobile_device_mtable
"mobile_device_menu"=>"ajax_mobile_device_menu",
// other_tax
"other_tax"=>"ajax_other_tax"
"other_tax"=>"ajax_other_tax",
//visibility quantity
"update_visibility_quantity"=>"ajax_update_visibility_quantity"
) ;
if (array_key_exists($op, $path)) {
@ -639,7 +641,7 @@ EOF;
{
echo '<div>';
echo '<h1 >'.$ajrn[0]['jrn_def_name'].'</h1>';
if ( trim($ajrn[0]['jrn_def_description']) != "") {
if ( noalyss_trim($ajrn[0]['jrn_def_description']) != "") {
echo '<p style="border:1px solid;margin-top:0px;padding:1rem">'.$ajrn[0]['jrn_def_description'].'</p>';
}
echo '</div>';

View file

@ -141,6 +141,7 @@ function error_get_predef(request, json)
alert_box(content[49]);
}
/**
* update the list of available predefined operation when we change the ledger.
*/
@ -265,6 +266,45 @@ function update_row(ctl)
alert_box(e.message);
}
}
/**
* @brief hide or show the column quantity
*/
function update_visibility_quantity()
{
var jrn = g("p_jrn").value;
var dossier = g("gDossier").value;
var querystring = 'gDossier=' + dossier + '&l=' + jrn + "&op=update_visibility_quantity";
var action = new Ajax.Request(
"ajax_misc.php",
{
method: 'get',
parameters: querystring,
onSuccess: function (req) {
try {
// retrieve quantity
var quantity_col=document.getElementsByClassName("col_quant");
for (var i=0;i < quantity_col.length;i++){
if (req.responseText=="0") {
// hide the columns quantity and return
quantity_col[i].hide();
quantity_col[i].addClassName('d-none');
}
if (req.responseText=="1") {
// show the columns quantity and return
quantity_col[i].show();
quantity_col[i].removeClassName('d-none');
}
}
} catch (e) {
console.error("update_visibility_quantity"+e.message);
}
}
}
);
}
/**
* Put into the span, the name of the bank, the bank account
* and the quick_code

View file

@ -0,0 +1,35 @@
<?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 respond ajax request, the get contains
* the value :
* - l for ledger
* - gDossier
* Must return 1 if quantity is visible or 0 if not
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
global $http;
$cn=Dossier::connect();
$ledger=new Acc_Ledger($cn,$http->get("l","number",0));
$ledger->load();
if ($ledger->id==0) throw new Exception("UPDVIS34.Invalide ledger");
echo $ledger->has_quantity();

View file

@ -1131,6 +1131,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
public function input($p_array=null,$p_readonly=0)
{
global $g_parameter,$g_user;
// load ledger definition
$this->load();
$http=new HttpInput();
if ( $p_array != null ) extract($p_array, EXTR_SKIP);
@ -1217,7 +1219,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$add_js.='update_name();';
$add_js.='update_pay_method();';
$add_js.='update_row("sold_item");';
$add_js.='update_other_tax()';
$add_js.='update_other_tax();';
$add_js.='update_visibility_quantity();';
$wLedger=$this->select_ledger('ACH',2,FALSE);

View file

@ -253,6 +253,8 @@ class Acc_Ledger_Sale extends Acc_Ledger {
public function insert($p_array = null) {
global $g_parameter;
// load ledger definition
$this->load();
extract($p_array, EXTR_SKIP);
$this->verify($p_array);
@ -873,7 +875,7 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$r.='</tr>';
$r.='</table>';
$r.='</div>';
$r.='<div style="position:float;clear:both">';
$r.='<div style="float:none;clear:both">';
$r.='</div>';
$r.='<h2>' . _('Détail articles vendus') . '</h2>';
@ -1254,6 +1256,8 @@ EOF;
function input($p_array = null, $p_readonly = 0) {
global $g_parameter, $g_user;
// load ledger definition
$this->load();
$http=new HttpInput();
if ($p_array != null) {
extract($p_array, EXTR_SKIP);
@ -1329,7 +1333,8 @@ EOF;
$add_js.='update_name();';
$add_js.='update_pay_method();';
$add_js.='update_row("sold_item");';
$add_js.='update_other_tax()';
$add_js.='update_other_tax();';
$add_js.='update_visibility_quantity();';
$wLedger = $this->select_ledger('VEN', 2,FALSE);
if ($wLedger == null)

View file

@ -81,6 +81,9 @@
<br>
<?php
$hidden=($this->has_quantity()==0)?'d-none':'';
?>
<h2><?php echo $f_legend_detail?></h2>
<table id="sold_item" >
<tr>
@ -88,7 +91,7 @@
<th class="visible_gt800 visible_gt1155"><?php echo _('Dénomination')?></th>
<?php if ($flag_tva =='Y') : ?>
<th><?php echo _('prix/unité htva')?><?php echo Icon_Action::infobulle(6)?></th>
<th><?php echo _('quantité')?></th>
<th class="col_quant <?=$hidden?>"><?php echo _('quantité')?></th>
<th class="visible_gt800" ><?php echo _('Total HTVA')?></th>
<th><?php echo _('tva')?></th>
<th class="visible_gt800"><?php echo _('tot.tva')?></th>
@ -112,7 +115,7 @@ echo '<td>'.$item['bt'].$item['card_add'].'</td>';
<td class="visible_gt800 visible_gt1155"><?php echo $item['denom'] ?></td>
<?php
echo td($item['pu']);
echo td($item['quantity' ]);
echo td($item['quantity' ],'class="col_quant '. $hidden.'"');
echo td($item['htva'],' class="visible_gt800" ');
if ($flag_tva=='Y') {
echo td($item['tva']);