Task 0002128: Clôture comptabilité française

This commit is contained in:
sparkyx 2024-01-07 18:31:40 +01:00
parent e723c5c5b1
commit 15182958d7
14 changed files with 638 additions and 30 deletions

View file

@ -338,7 +338,12 @@ $path = array(
"operation_exercice+display_total"=>"ajax_operation_exercice",
// delete row in exercice (opening/closing) operation
"operation_exercice+delete_row"=>"ajax_operation_exercice",
// date in exercice (opening/closing) operation
"operation_exercice+date"=>"ajax_operation_exercice",
// text in exercice (opening/closing) operation
"operation_exercice+text"=>"ajax_operation_exercice",
// transfer operation to accountancy
'operation_exercice+transfer'=>"ajax_operation_exercice",
) ;
if (array_key_exists($op, $path)) {

View file

@ -1697,7 +1697,7 @@ var operation_exercice = {
console.error('oe-update_periode', e.message);
}
},
modify_row: function (row_operation_exercice,oe_id) {
modify_row: function (row_operation_exercice, oe_id) {
try {
var dgbox = "operation_exercice_bx";
waiting_box();
@ -1708,7 +1708,7 @@ var operation_exercice = {
console.debug(row_operation_exercice);
var queryString = {
op: 'operation_exercice+modify_row',
oe_id : oe_id,
oe_id: oe_id,
row_id: row_operation_exercice,
gDossier: $('gDossier').value
};
@ -1764,18 +1764,20 @@ var operation_exercice = {
}
if (req.responseJSON['status'] == "OK") {
rowid=req.responseJSON['row_id'];
rowid = req.responseJSON['row_id'];
if (queryString['row_id'] == -1) {
var row = new Element("tr");
row.id="oe_"+rowid;
row.setAttribute("oed_id",rowid);
row.setAttribute("oe_id",req.responseJSON['oe_id']);
row.id = "oe_" + rowid;
row.setAttribute("oed_id", rowid);
row.setAttribute("oe_id", req.responseJSON['oe_id']);
row.update(req.responseJSON['content']);
$("operation_exercice_tb").appendChild(row);
row.addEventListener("click",function(event) {operation_exercice.click_modify_row(row)})
row.addEventListener("click", function (event) {
operation_exercice.click_modify_row(row)
})
} else{
$("oe_"+rowid).update(req.responseJSON['content']);
} else {
$("oe_" + rowid).update(req.responseJSON['content']);
}
new Effect.Highlight("oe_" + req.responseJSON['row_id'], {
startcolor: '#FAD4D4',
@ -1863,6 +1865,39 @@ var operation_exercice = {
}
},
click_modify_row: function (item) {
operation_exercice.modify_row(item.getAttribute("oed_id"),item.getAttribute("oe_id"));
operation_exercice.modify_row(item.getAttribute("oed_id"), item.getAttribute("oe_id"));
},
/**
* check and transfer if it is good
*/
transfer: function () {
try {
var dgbox = "oe_transfer_div";
waiting_box();
var queryString = $("operation_exercice_transfer_frm").serialize(true);
var action = new Ajax.Request(
"ajax_misc.php",
{
method: 'GET',
parameters: queryString,
onFailure: ajax_misc_failure,
onSuccess: function (req) {
remove_waiting_box();
if (req.responseText == 'NOCONX') {
reconnect();
return;
}
var answer=req.responseJSON;
console.debug(answer['content']);
$('operation_exercice_transfer_info').update(answer.content);
}
}
);
} catch (e) {
alert_box(e.message);
}
}
}

View file

@ -52,14 +52,14 @@ if ($op == "operation_exercice+update_periode") {
if ($op == "operation_exercice+modify_row") {
try {
$row_id = $http->post("row_id", "number", -1);
$oe_id=$http->post("oe_id","number");
$oe_id = $http->post("oe_id", "number");
} catch (\Exception $e) {
echo $e->getMessage();
return;
}
$operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, $row_id);
$operation_detail_sql->oe_id=$oe_id;
if ( $row_id == -1) $operation_detail_sql->oed_debit='f';
$operation_detail_sql->oe_id = $oe_id;
if ($row_id == -1) $operation_detail_sql->oed_debit = 'f';
Operation_Exercice::input_row($operation_detail_sql);
return;
@ -86,7 +86,7 @@ if ($op == "operation_exercice+save_row") {
->setp("oed_qcode", $qcode)
->setp("oed_label", $label)
->setp("oed_amount", $amount)
->setp("oe_id",$oe_id)
->setp("oe_id", $oe_id)
->setp("oed_debit", $debit);
try {
$operation_detail_sql->save();
@ -94,7 +94,7 @@ if ($op == "operation_exercice+save_row") {
ob_start();
$operation_exercice = new Operation_Exercice();
if ($row_id == -1 ) {
if ($row_id == -1) {
$operation_exercice->display_row($data, true);
} else {
@ -140,14 +140,108 @@ if ($op == "operation_exercice+delete_row") {
try {
$row_id = $http->get("row_id", "number");
$operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, $row_id);
$oe_id=$operation_detail_sql->oe_id;
$other_row=$cn->get_value("select oed_id from operation_exercice_detail where oe_id=$1 limit 1 ",
[$oe_id]);
$oe_id = $operation_detail_sql->oe_id;
$other_row = $cn->get_value("select oed_id from operation_exercice_detail where oe_id=$1 limit 1 ",
[$oe_id]);
$operation_detail_sql->delete();
echo json_response(array("status"=>"OK","row_id"=>$other_row));
echo json_response(array("status" => "OK", "row_id" => $other_row));
} catch (\Exception $e) {
echo $e->getMessage();
return;
}
}
//-------------------------------------------------------------------------------------------
// Change the date
//-------------------------------------------------------------------------------------------
if ($op == "operation_exercice+date") {
try {
$oe_id = $http->request("oe_id", "number");
} catch (\Exception $e) {
echo $e->getMessage();
}
$input = $http->request("input");
$action = $http->request("ieaction", "string", "display");
$ajax_date = Inplace_Edit::build($input);
$ajax_date->add_json_param("op", "operation_exercice+date");
$ajax_date->add_json_param("gDossier", Dossier::id());
$ajax_date->add_json_param("oe_id", $oe_id);
$ajax_date->set_callback("ajax_misc.php");
if ($action == "display") {
echo $ajax_date->ajax_input();
}
if ($action == "ok") {
$value = $http->request("value");
$cn->exec_sql("update operation_exercice set oe_date=to_date($1,'DD.MM.YYYY') where oe_id=$2", [$value, $oe_id]);
$ajax_date->set_value($value);
echo $ajax_date->value();
}
if ($action == "cancel") {
echo $ajax_date->value();
}
return;
}
//-------------------------------------------------------------------------------------------
// Change the text
//-------------------------------------------------------------------------------------------
if ($op == "operation_exercice+text") {
try {
$oe_id = $http->request("oe_id", "number");
} catch (\Exception $e) {
echo $e->getMessage();
}
$input = $http->request("input");
$action = $http->request("ieaction", "string", "display");
$ajax_text = Inplace_Edit::build($input);
$ajax_text->add_json_param("op", "operation_exercice+text");
$ajax_text->add_json_param("gDossier", Dossier::id());
$ajax_text->add_json_param("oe_id", $oe_id);
$ajax_text->set_callback("ajax_misc.php");
if ($action == "display") {
echo $ajax_text->ajax_input();
}
if ($action == "ok") {
$value = $http->request("value");
$cn->exec_sql("update operation_exercice set oe_text=$1 where oe_id=$2", [$value, $oe_id]);
$ajax_text->set_value($value);
echo $ajax_text->value();
}
if ($action == "cancel") {
echo $ajax_text->value();
}
return;
}
//-------------------------------------------------------------------------------------------
// Check and transfer to accountancy if OK
//-------------------------------------------------------------------------------------------
if ($op == "operation_exercice+transfer") {
try {
$operation_exercice_id = $http->request("oe_id", "number");
$ledger_id = $http->request('p_jrn', "number");
if ($g_user->check_jrn($ledger_id) == "X") throw new \Exception (EXC_FORBIDDEN);
} catch (\Exception $e) {
echo $e->getMessage();
return;
}
// first , check that everything is ok
$operation_exercice = new Operation_Exercice($operation_exercice_id);
global $oe_result, $oe_status;
$answer = array();
$operation_exercice->submit_transfer($ledger_id);
$answer['status'] = $oe_status;
if ($answer['status'] == 'NOK') {
$answer['content'] = span($oe_result, 'class=warning');
}else {
$answer['content'] = span($oe_result);
}
echo json_response($answer);
return;
}

View file

@ -24,13 +24,26 @@
class Operation_Closing extends Operation_Exercice
{
private $signature ;
private $exercice;
function __construct()
function __construct($p_id)
{
parent::__construct();
parent::__construct($p_id);
$this->signature='closing';
}
public function get_exercice()
{
return $this->exercice;
}
/**
* @param mixed $exercice
*/
public function set_exercice($exercice): void
{
$this->exercice = $exercice;
}
public function get_signature(): string
{
return $this->signature;
@ -38,6 +51,76 @@ class Operation_Closing extends Operation_Exercice
function from_request()
{
$http = new HttpInput();
$this->exercice = $http->request("exercice_cl", "number");
}
/**
* @brief insert data into data operation_exercice and operation_exercice_detail
* @return void
*/
function insert()
{
$cn = Dossier::connect();
$sql = "
with total_account as (
select sum(a.montant) as tot_amount, j_poste, f_id
from
(select j_id, case when j_debit='t' then j_montant
else j_montant * (-1) end as montant
from jrnx) as a
join jrnx using (j_id)
join parm_periode on (j_tech_per = p_id )
where
p_exercice=$1
and( j_poste::text like '7%'
or j_poste::text like '6%')
group by j_poste,f_id
having (sum(a.montant) != 0 )
)
select t1.tot_amount
,t1.j_poste
,(select pcm_lib from tmp_pcmn where pcm_val=t1.j_poste) as lib_accounting
,t1.f_id
,(select ad_value fd2 from fiche_detail fd2 where fd2.f_id=t1.f_id and fd2.ad_id=23) qcode
,(select fd3.ad_value from fiche_detail fd3 where fd3.f_id=t1.f_id and fd3.ad_id=1) f_name
,abs(t1.tot_amount) atot_amount
,case when tot_amount <0 then 'f' else 't' end debit
from total_account t1
";
$exercice_report=$this->exercice;
$this->operation_exercice_sql->setp("oe_type", $this->signature)
->setp("oe_dossier_id", Dossier::id())
->set("oe_text",_("Ecriture cloture $exercice_report"))
->setp("oe_exercice", $this->exercice);
try {
$cn->start();
$this->operation_exercice_sql->insert();
$array = $cn->get_array($sql, array($this->exercice));
if (empty($array)) return;
foreach ($array as $item) {
$row = new Operation_Exercice_Detail_SQL($cn);
$row->oe_id = $this->operation_exercice_sql->oe_id;
$row->oed_poste = (empty($item['qcode']))?$item["j_poste"]:null;
$row->oed_qcode = $item["qcode"];
$row->oed_amount = $item['atot_amount'];
$row->oed_label=(empty($item['qcode']))?$item['lib_accounting']:$item['f_name'];
$row->oed_debit = $item["debit"];
$row->save();
}
$cn->commit();
} catch (\Exception $e) {
$cn->rollback();
echo $e->getMessage();
throw $e;
}
}
public function display_result()
{
echo h2("Clôture compte");
parent::display_result(); // TODO: Change the autogenerated stub
}
}

View file

@ -26,6 +26,7 @@ class Operation_Exercice
{
protected $operation_exercice_sql;
public function __construct($p_id = -1)
{
$this->operation_exercice_sql = new Operation_Exercice_SQL(Dossier::connect(), $p_id);
@ -42,6 +43,27 @@ class Operation_Exercice
function display_result()
{
$date = new IDate("exercice_date");
$date->id = "exercice_date";
$date->value = format_date($this->operation_exercice_sql->getp("oe_date"), "DD.MM.YYYY");
$inplace_date = new Inplace_Edit($date);
$inplace_date->add_json_param("op", "operation_exercice+date");
$inplace_date->add_json_param("gDossier", Dossier::id());
$inplace_date->add_json_param("oe_id", $this->operation_exercice_sql->oe_id);
$inplace_date->set_callback("ajax_misc.php");
echo _("Date"), $inplace_date->input();
$text_operation = new IText("text_operation");
$text_operation->id = uniqid("text");
$text_operation->size = 80;
$text_operation->value = $this->operation_exercice_sql->getp("oe_text");
$inplace_text = new Inplace_Edit($text_operation);
$inplace_text->add_json_param("op", "operation_exercice+text");
$inplace_text->add_json_param("gDossier", Dossier::id());
$inplace_text->add_json_param("oe_id", $this->operation_exercice_sql->oe_id);
$inplace_text->set_callback("ajax_misc.php");
echo $inplace_text->input();
$cn = Dossier::connect();
// get data
$a_data = $cn->get_array("
@ -59,6 +81,7 @@ class Operation_Exercice
", [$this->operation_exercice_sql->oe_id]);
$aheader = array(_("Poste"), _("Fiche"), _("Libellé"), _("Montant"), _("Débit/Crédit"));
echo '<div></div>';
echo \HtmlInput::filter_table("operation_exercice_tb", '0,1,2,3,4', 1);
echo \HtmlInput::button_action(_("Ajouter une ligne"), sprintf("operation_exercice.modify_row('-1','%s')", $this->operation_exercice_sql->oe_id));
echo '<table class="result" id="operation_exercice_tb">';
@ -107,7 +130,7 @@ select sum(signed_amount) delta,sum(debit) debit,sum(credit) credit from saldo_d
echo span(sprintf(_("Débit %s"), nbm($total['debit'])), $style);
echo span(sprintf(_("Crédit %s"), nbm($total['credit'])), $style);
$s="";
$s = "";
if ($total['delta'] > 0) {
$s = " Solde débiteur ";
}
@ -150,7 +173,125 @@ select sum(signed_amount) delta,sum(debit) debit,sum(credit) credit from saldo_d
*/
public static function input_row(Operation_Exercice_Detail_SQL $operation_detail_sql)
{
$operation=new Operation_Exercice_SQL($operation_detail_sql->get_cn(),$operation_detail_sql->getp("oe_id"));
if ( $operation->getp("oe_transfer_date") !="") {
require_once NOALYSS_TEMPLATE . "/operation_exercice-input_row-error.php";
return;
}
require_once NOALYSS_TEMPLATE . "/operation_exercice-input_row.php";
}
/**
* @brief input data for transfering
* @return void
*/
function input_transfer()
{
$operation=$this->operation_exercice_sql;
if ( $operation->getp("oe_transfer_date") !="") {
echo '<span class="warning">';
printf(_("Opération transférée le %s")
,$operation->getp("oe_transfer_date") );
echo '</span>';
return;
}
require_once NOALYSS_TEMPLATE . "/operation_exercice-input_transfer.php";
}
/**
* @brief transfer to accountancy
* @param $ledger_id int the ledger id (jrn_def_id)
* @return void
*/
function submit_transfer($ledger_id)
{
global $oe_result; // result of operation
global $oe_data; // transform data to array used by Acc_Ledger::insert
global $oe_status ; // status OK or NOK
$cn = Dossier::connect();
$this->transform($ledger_id);
$oe_status = "OK";
$ledger = new Acc_Ledger($cn, $ledger_id);
try {
$cn->start();
if ($this->operation_exercice_sql->getp("oe_transfer_date")!="") throw new \Exception("duplicate",EXC_DUPLICATE);
if ( empty($oe_data['e_date'] ) ) throw new \Exception ("Date null",2);
$ledger->verify_operation($oe_data);
$ledger->save($oe_data);
$oe_result=_("Détail opération");
$oe_result.=sprintf('<a class="detail" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a><hr>',
$ledger->jr_id, dossier::id(), $ledger->internal);
$cn->exec_sql("update operation_exercice set oe_transfer_date=to_timestamp($1,'DD.MM.YY HH24:MI') , jr_internal=$2 where oe_id=$3",
[date('d.m.Y H:i'),$ledger->internal,$this->operation_exercice_sql->oe_id]);
$cn->commit();
return true;
} catch (\Exception $e) {
// $a_error=array(2=>_("la date est obligatoire",),1=>_('Crédit et débit non équilibré'),3=>_("Montant invalide"),
// 4=>_("Fiche non permise dans ce journal"),6=>_("Période fermée ou inexistante"),EXC_DUPLICATE=>_("Opération déja transférée"));
// $exc_code=$e->getCode();
//
// if ( isset($a_error[$exc_code] ) )
// $oe_result=$a_error[$e->getCode()];
// else
$oe_result=$e->getMessage();
$oe_status='NOK';
$cn->rollback();
}
return false;
}
function transform($ledger_id)
{
global $oe_data; // transform data to array used by Acc_Ledger::verify_operation
$cn = Dossier::connect();
$acc_ledger=new \Acc_Ledger($cn, $ledger_id);
$oe_data = array();
$oe_data['p_currency_code'] = 0;
$oe_data['p_currency_rate'] = 1;
$oe_data['p_jrn'] = $ledger_id;
$oe_data['e_date'] = $this->operation_exercice_sql->oe_date;
$oe_data['desc']=$this->operation_exercice_sql->getp("oe_text");
$operation_detail_sql = new Operation_Exercice_Detail_SQL($cn);
$all_operation = $operation_detail_sql->collect_objects(' where oe_id = $1',[$this->operation_exercice_sql->oe_id]);
$nb = 0;
foreach ($all_operation as $item) {
$oe_data['qc_' . $nb] = $item->oed_qcode;
$oe_data['poste' . $nb] = $item->oed_poste;
$oe_data['ld' . $nb] = $item->oed_label;
$oe_data['amount' . $nb] = $item->oed_amount;
if ($item->oed_debit == "t") $oe_data['ck' . $nb] = 't';
$nb++;
}
$oe_data['nb_item']=$nb;
$oe_data['e_pj']=$acc_ledger->guess_pj();
$oe_data['e_pj_suggest']=$acc_ledger->guess_pj();
$oe_data['mt']=microtime(true);
$oe_data['jr_optype']=($this->operation_exercice_sql->getp('oe_type')=='opening')?'OPE':'CLO';
}
public static function list_draft()
{
require_once NOALYSS_TEMPLATE."/operation_exercice-list_draft.php";
}
public static function delete($aOperation_id)
{
$cn=Dossier::connect();
foreach ($aOperation_id as $operation_id)
{
$cn->exec_sql("delete from operation_exercice where oe_id=$1",[$operation_id]);
}
}
}

View file

@ -28,9 +28,9 @@ class Operation_Opening extends Operation_Exercice
private $from_folder;
private $exercice;
function __construct()
function __construct($p_id)
{
parent::__construct();
parent::__construct($p_id);
$this->signature = 'opening';
}
@ -143,4 +143,10 @@ from total_account t1
}
}
public function display_result()
{
echo h2("Ouverture compte");
parent::display_result(); // TODO: Change the autogenerated stub
}
}

View file

@ -49,6 +49,7 @@ class Operation_Exercice_SQL extends Table_Data_SQL
"tech_date" => "tech_date",
"oe_dossier_id" => "oe_dossier_id",
"oe_exercice" => "oe_exercice",
"oe_transfer_date"=>"oe_transfer_date"
);
/*
@ -63,7 +64,7 @@ class Operation_Exercice_SQL extends Table_Data_SQL
"tech_date" => "date",
"oe_dossier_id" => "number",
"oe_exercice" => "number",
"oe_transfer_date"=>"date"
);

View file

@ -306,6 +306,17 @@ class Icon_Action
$p_javascript);
return $r;
}
static function detail_anchor($p_id,$url)
{
$r=sprintf('
<A HREF="%s">
<span id="%s" class="smallicon icon" style="margin-left:5px">&#xe803;</span></A>',
$url
,$p_id);
return $r;
}
static function more($p_id,$p_javascript)
{
$r=sprintf('<span id="%s" onclick="%s" class="smallicon icon" style="margin-left:5px">&#xe824;</span>',

View file

@ -140,7 +140,22 @@ abstract class Table_Data_SQL extends Data_SQL
$sql=" delete from ".$this->table." where ".$this->primary_key."= $1";
$this->cn->exec_sql($sql,array($this->$pk));
}
/**
* @brief update the value of a column with an expression for $value for the current record
* @param $column_exp string like column = $1 or column=function($1)
* @param $value value replacing $1
* @note you can use it for entering a date with the hour and minute like this
* $this->column_update("field_date = to_date($1,'DD.MM.YY HH24:MI'),date('d.m.Y H:i'))
*
* @return Table_Data_SQL
*/
function column_update($column_expr,$value) {
$pk=$this->primary_key;
$sql="update ".$this->table." set {$column_expr} where {$this->primary_key} = $2";
$this->cn->exec_sql($sql,[$value,$this->$pk]);
return $this;
}
public function update()
{
$this->verify();

View file

@ -26,6 +26,15 @@ $http=new HttpInput();
if ( $http->request("sa","string","") == "" )
{
Operation_Exercice::input_source();
Operation_Exercice::list_draft();
return;
}
if ( $http->request("sa","string" ) == "remove" )
{
Operation_Exercice::delete($http->post("operation_list"));
Operation_Exercice::input_source();
Operation_Exercice::list_draft();
return;
}
if ( $http->request("sa") == "opening")
@ -34,16 +43,35 @@ if ( $http->request("sa") == "opening")
$operation_exercice_id= $http->get("operation_exercice_id","number",-1);
$operation_opening=new Operation_Opening($operation_exercice_id);
try {
// take data from request
$operation_opening->from_request();
if ( $operation_exercice_id == -1 ) {
// take data from request
$operation_opening->from_request();
$operation_opening->insert();
}
// Display result
$operation_opening->display_result();
$operation_opening->input_transfer();
} catch (\Exception $e) {
echo $e->getMessage();
}
return;
}
}
if ( $http->request("sa") == "closing")
{
$operation_exercice_id= $http->get("operation_exercice_id","number",-1);
$operation_closing=new Operation_Closing($operation_exercice_id);
try {
if ( $operation_exercice_id == -1 ) {
// take data from request
$operation_closing->from_request();
$operation_closing->insert();
}
// Display result
$operation_closing->display_result();
$operation_closing->input_transfer();
} catch (\Exception $e) {
echo $e->getMessage();
}
return;
}

View file

@ -0,0 +1,31 @@
<?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 11/01/24
/*!
* \file
* \brief operation already transfered
*/
Noalyss\Dbg::echo_file(__FILE__);
echo \HtmlInput::title_box("", "operation_exercice_bx");
printf(_("Opération transférée le %s"),$operation->getp("oe_transfer_date") );
echo '<ul class="aligned-block">';
echo \HtmlInput::button_close("operation_exercice_bx") ;
echo '</li>';

View file

@ -0,0 +1,56 @@
<?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 7/01/24
/*!
* \file
* \brief propose to transfer
*/
Noalyss\Dbg::echo_file(__FILE__);
$cn=Dossier::connect();
?>
<?=HtmlInput::button_action(_("Transfert"),"$('operation_exercice_transfer_info').update();$('oe_transfer_div').show()")?>
<div class="inner_box" id="oe_transfer_div" style="display:none;position: fixed;top:25%;overflow-scrolling: auto">
<?= HtmlInput::title_box(_("Transfert à la comptabilité"), "oe_transfer_div") ?>
<form method="POST" id="operation_exercice_transfer_frm" onsubmit="operation_exercice.transfer();return false;">
<?php
echo HtmlInput::array_to_hidden(array("ac", "gDossier"), $_REQUEST);
echo HtmlInput::hidden("op", "operation_exercice+transfer");
echo HtmlInput::hidden("oe_id", $this->operation_exercice_sql->oe_id);
// show the ledger
$ledger = new Acc_Ledger($cn, 0);
$wLedger = $ledger->select_ledger('ODS', 2, FALSE);
if ($wLedger == null)
throw new Exception(_('Pas de journal disponible'));
echo _("Journal destination"), $wLedger->input();
?>
<div id="operation_exercice_transfer_info" ></div>
<ul class="aligned-block">
<li>
<?= \HtmlInput::submit("save", _("Sauve")) ?>
</li>
<li>
<?= \HtmlInput::button_hide("oe_transfer_div") ?>
</li>
</ul>
</form>
</div>

View file

@ -0,0 +1,100 @@
<?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 11/01/24
/*!
* \file
* \brief display draft OPERATION_EXERCICE
*/
$http = new HttpInput();
$cn=Dossier::connect();
$a_operation = $cn->get_array("select oe_id
,to_char(oe_date,'DD.MM.YY') str_date
,to_char(oe_transfer_date,'DD.MM.YY') str_transfer_date
,to_char(tech_date,'DD.MM.YY HH24:MI') draft_date
,jr_internal
,tech_user
,oe_text
,oe_type
from operation_exercice order by oe_id desc");
$aUrl = ["ac" => $http->request("ac"), "gDossier" => Dossier::id()];
$checkbox=new ICheckBox("operation_list[]");
$checkbox->set_range("operation_range");
?>
<form method="POST">
<?php
echo \HtmlInput::array_to_hidden(["gDossier", "sa"], $_REQUEST);
echo \HtmlInput::hidden("sa", "remove");
?>
<table class="result">
<tr>
<th>
<?= _("Date brouillon") ?>
</th>
<th>
<?= _("Date opération") ?>
</th>
<th>
<?= _("Description") ?>
</th>
<th>
<?= _("Utilisateur") ?>
</th>
<th>
<?= _("Date transfert") ?>
</th>
<th><?=_("opération")?></th>
<th>
</th>
</tr>
<?php
foreach ($a_operation as $operation) {
$aUrl['operation_exercice_id'] = $operation['oe_id'];
$aUrl['sa'] = $operation['oe_type'];
$url = NOALYSS_URL . "/do.php?" . http_build_query($aUrl);
$checkbox->value=$operation['oe_id'];
$detail="";
if ( ! empty ($operation['jr_internal'])) {
$jr_id=$cn->get_value("select jr_id from jrn where jr_internal =$1",[$operation['jr_internal']]);
if (!empty($jr_id))
$detail=\HtmlInput::detail_op($jr_id,$operation['jr_internal']);
}
?>
<tr>
<td class=""><?=$operation['draft_date']?></td>
<td class=""><?=$operation['str_date']?></td>
<td class=""><?=$operation['oe_text']?></td>
<td class=""><?=$operation['tech_user']?></td>
<td class=""><?=$operation['str_transfer_date']?></td>
<td class=""><?=$detail?></td>
<td class=""><?=\Icon_Action::detail_anchor(uniqid(), $url)?></td>
<td><?=$checkbox->input()?></td>
</tr>
<?php
}
?>
</table>
<?=\HtmlInput::submit("remove",_("Efface la sélection"))?>
</form>
<?php
echo ICheckBox::javascript_set_range("operation_range");

View file

@ -72,6 +72,8 @@ create table operation_exercice
oe_text text ,
oe_dossier_id int not null,
oe_exercice int not null,
jr_internal text,
oe_transfer_date timestamp,
tech_user text,
tech_date timestamp default now()
);