From 15182958d725699324df24a9d2084e8f7eb6d44f Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 7 Jan 2024 18:31:40 +0100 Subject: [PATCH] =?UTF-8?q?Task=200002128:=20Cl=C3=B4ture=20comptabilit?= =?UTF-8?q?=C3=A9=20fran=C3=A7aise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/ajax_misc.php | 7 +- html/js/acc_ledger.js | 55 +++++-- include/ajax/ajax_operation_exercice.php | 112 ++++++++++++-- include/class/operation_closing.class.php | 87 ++++++++++- include/class/operation_exercice.class.php | 143 +++++++++++++++++- include/class/operation_opening.class.php | 10 +- .../database/operation_exercice_sql.class.php | 3 +- include/lib/icon_action.class.php | 11 ++ include/lib/table_data_sql.class.php | 15 ++ include/operation_exercice.inc.php | 36 ++++- .../operation_exercice-input_row-error.php | 31 ++++ .../operation_exercice-input_transfer.php | 56 +++++++ .../operation_exercice-list_draft.php | 100 ++++++++++++ sql/upgrade.sql | 2 + 14 files changed, 638 insertions(+), 30 deletions(-) create mode 100644 include/template/operation_exercice-input_row-error.php create mode 100644 include/template/operation_exercice-input_transfer.php create mode 100644 include/template/operation_exercice-list_draft.php diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 173edfb35..63b197768 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -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)) { diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index 8c205ff85..5952e76b9 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -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); + } } } diff --git a/include/ajax/ajax_operation_exercice.php b/include/ajax/ajax_operation_exercice.php index 0b253ac3d..af43693b6 100644 --- a/include/ajax/ajax_operation_exercice.php +++ b/include/ajax/ajax_operation_exercice.php @@ -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; +} \ No newline at end of file diff --git a/include/class/operation_closing.class.php b/include/class/operation_closing.class.php index b82a6bc1d..2794e22d3 100644 --- a/include/class/operation_closing.class.php +++ b/include/class/operation_closing.class.php @@ -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 + } } \ No newline at end of file diff --git a/include/class/operation_exercice.class.php b/include/class/operation_exercice.class.php index 076463357..d76e4bd05 100644 --- a/include/class/operation_exercice.class.php +++ b/include/class/operation_exercice.class.php @@ -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 '
'; 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 ''; @@ -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 ''; + printf(_("Opération transférée le %s") + ,$operation->getp("oe_transfer_date") ); + echo ''; + 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('%s
', + $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]); + } + } + } diff --git a/include/class/operation_opening.class.php b/include/class/operation_opening.class.php index 298a2ca8d..4252cb972 100644 --- a/include/class/operation_opening.class.php +++ b/include/class/operation_opening.class.php @@ -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 + } } \ No newline at end of file diff --git a/include/database/operation_exercice_sql.class.php b/include/database/operation_exercice_sql.class.php index c295d9002..9bb256b8d 100644 --- a/include/database/operation_exercice_sql.class.php +++ b/include/database/operation_exercice_sql.class.php @@ -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" ); diff --git a/include/lib/icon_action.class.php b/include/lib/icon_action.class.php index ed6ad1c23..d189cc3e1 100644 --- a/include/lib/icon_action.class.php +++ b/include/lib/icon_action.class.php @@ -306,6 +306,17 @@ class Icon_Action $p_javascript); return $r; } + + static function detail_anchor($p_id,$url) + { + $r=sprintf(' + + ', + $url + ,$p_id); + + return $r; + } static function more($p_id,$p_javascript) { $r=sprintf('', diff --git a/include/lib/table_data_sql.class.php b/include/lib/table_data_sql.class.php index d34699623..7b5428adc 100644 --- a/include/lib/table_data_sql.class.php +++ b/include/lib/table_data_sql.class.php @@ -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(); diff --git a/include/operation_exercice.inc.php b/include/operation_exercice.inc.php index 40555f4b6..b54a25388 100644 --- a/include/operation_exercice.inc.php +++ b/include/operation_exercice.inc.php @@ -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; -} \ No newline at end of file +} +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; +} diff --git a/include/template/operation_exercice-input_row-error.php b/include/template/operation_exercice-input_row-error.php new file mode 100644 index 000000000..f6b2c0e9c --- /dev/null +++ b/include/template/operation_exercice-input_row-error.php @@ -0,0 +1,31 @@ +getp("oe_transfer_date") ); +echo '
+ + + + + + + + + + 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']); + } + ?> + + + + + + + + + + + +
+ + + + + + + + + + + + +
input()?>
+ + +