45 require NOALYSS_TEMPLATE .
"/operation_exercice-input_source.php";
51 $date->id =
"exercice_date";
52 $date->value =
format_date($this->operation_exercice_sql->getp(
"oe_date"),
"DD.MM.YYYY");
54 $inplace_date->add_json_param(
"op",
"operation_exercice+date");
55 $inplace_date->add_json_param(
"gDossier", Dossier::id());
56 $inplace_date->add_json_param(
"oe_id", $this->operation_exercice_sql->oe_id);
57 $inplace_date->set_callback(
"ajax_misc.php");
58 echo
_(
"Date"), $inplace_date->input();
60 $text_operation =
new IText(
"text_operation");
61 $text_operation->id = uniqid(
"text");
62 $text_operation->size = 80;
63 $text_operation->value = $this->operation_exercice_sql->getp(
"oe_text");
65 $inplace_text->add_json_param(
"op",
"operation_exercice+text");
66 $inplace_text->add_json_param(
"gDossier", Dossier::id());
67 $inplace_text->add_json_param(
"oe_id", $this->operation_exercice_sql->oe_id);
68 $inplace_text->set_callback(
"ajax_misc.php");
69 echo $inplace_text->input();
71 $cn = Dossier::connect();
73 $a_data =
$cn->get_array(
"
81 FROM public.operation_exercice_detail
84 order by oed_debit desc,oed_poste,oed_qcode
86 ", [$this->operation_exercice_sql->oe_id]);
87 $aheader = array(
_(
"Poste"),
_(
"Fiche"),
_(
"Libellé"),
_(
"Montant"),
_(
"Débit/Crédit"));
89 echo \HtmlInput::filter_table(
"operation_exercice_tb",
'0,1,2,3,4', 1);
90 echo \HtmlInput::button_action(
_(
"Ajouter une ligne"), sprintf(
"operation_exercice.modify_row('-1','%s')", $this->operation_exercice_sql->oe_id));
91 echo
'<table class="result" id="operation_exercice_tb">';
95 foreach ($a_data as
$data) {
99 echo \HtmlInput::button_action(
_(
"Ajouter une ligne"), sprintf(
"operation_exercice.modify_row('-1','%s')", $this->operation_exercice_sql->oe_id));
101 echo Dossier::hidden();
104 $$(
".op-exercice").forEach(item=>item.addEventListener(
"click",
function(event) {operation_exercice.click_modify_row(item)}));
116 $cn = Dossier::connect();
118 with saldo_deb_cred as
121 case when oed_debit is true then oed_amount else 0-oed_amount end signed_amount ,
122 case when oed_debit is true then oed_amount end debit,
123 case when oed_debit is false then oed_amount end credit
124 from public.operation_exercice_detail
127select sum(signed_amount) delta,sum(debit) debit,sum(credit) credit from saldo_deb_cred
129 $total =
$cn->get_row($sql_total, [$this->operation_exercice_sql->oe_id]);
131 echo
'<span id="tot_ope_exe" style="margin-left:20%">';
133 $style =
'style="display:inline-block;padding:1rem;margin:1rem;border:1px solid navy;width:20%;text-align:center;font-size:140%"';
138 if (
$total[
'delta'] > 0) {
139 $s =
" Solde débiteur ";
141 if (
$total[
'delta'] < 0) {
142 $s =
" Solde créditeur ";
159 if ($row_tr) printf(
'<tr class="op-exercice even" id="oe_%s" oed_id="%s" oe_id="%s">',
$data[
'oed_id'],
$data[
'oed_id'],
$data[
'oe_id']);
163 echo
td(
nbm(
$data[
'oed_amount']),
'class="num"');
164 echo
td((
$data[
'oed_debit'] ==
'f' ?
_(
"Crédit") :
_(
"Débit")),
'style="text-align:center"');
168 if ($row_tr)
print (
'</tr >');
181 if (
$operation->getp(
"oe_transfer_date") !=
"") {
182 require_once NOALYSS_TEMPLATE .
"/operation_exercice-input_row-error.php";
186 require_once NOALYSS_TEMPLATE .
"/operation_exercice-input_row.php";
196 if (
$operation->getp(
"oe_transfer_date") !=
"") {
197 echo
'<span class="warning">';
198 printf(
_(
"Opération transférée le %s")
203 require_once NOALYSS_TEMPLATE .
"/operation_exercice-input_transfer.php";
216 $cn = Dossier::connect();
224 if ($this->operation_exercice_sql->getp(
"oe_transfer_date")!=
"")
throw new \Exception(
"duplicate",
EXC_DUPLICATE);
225 if ( empty($oe_data[
'e_date'] ) )
throw new \Exception (
"Date null",2);
226 $ledger->verify_operation($oe_data);
228 $oe_result=
_(
"Détail opération");
229 $oe_result.=sprintf(
'<a class="detail" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a><hr>',
232 $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",
233 [date(
'd.m.Y H:i'),
$ledger->internal,$this->operation_exercice_sql->oe_id]);
237 }
catch (\Exception
$e) {
238 $oe_result=
$e->getMessage();
258 $cn = Dossier::connect();
261 $oe_data[
'p_currency_code'] = 0;
262 $oe_data[
'p_currency_rate'] = 1;
264 $oe_data[
'e_date'] = $this->operation_exercice_sql->oe_date;
265 $oe_data[
'desc']=$this->operation_exercice_sql->getp(
"oe_text");
267 $all_operation = $operation_detail_sql->collect_objects(
' where oe_id = $1',[$this->operation_exercice_sql->oe_id]);
269 foreach ($all_operation as $item) {
270 $oe_data[
'qc_' .
$nb] = $item->oed_qcode;
271 $oe_data[
'poste' .
$nb] = $item->oed_poste;
272 $oe_data[
'ld' .
$nb] = $item->oed_label;
273 $oe_data[
'amount' .
$nb] = $item->oed_amount;
275 if ($item->oed_debit ==
"t") $oe_data[
'ck' .
$nb] =
't';
278 $oe_data[
'nb_item']=
$nb;
279 $oe_data[
'e_pj']=$acc_ledger->guess_pj();
280 $oe_data[
'e_pj_suggest']=$acc_ledger->guess_pj();
281 $oe_data[
'mt']=microtime(
true);
282 $oe_data[
'jr_optype']=($this->operation_exercice_sql->getp(
'oe_type')==
'opening')?
'OPE':
'CLO';
289 require_once NOALYSS_TEMPLATE.
"/operation_exercice-list_draft.php";
293 public static function delete($aOperation_id)
295 $cn=Dossier::connect();
298 $cn->exec_sql(
"delete from operation_exercice where oe_id=$1",[
$operation_id]);
format_date($p_date, $p_from_format='YYYY-MM-DD', $p_to_format='DD.MM.YYYY')
format the date, when taken from the database the format is MM-DD-YYYY
th($p_string, $p_extra='', $raw='')
span($p_string, $p_extra='')
td($p_string='', $p_extra='')
surround the string with td
nbm($p_number, $p_dec=2)
format the number with a sep.
h( $row[ 'oa_description'])
if(isNumber($jr_id)==0) $ledger_id
_("actif, passif,charge,...")
Class for jrn, class acc_ledger for manipulating the ledger AND some acc.
getp($p_string)
set the value thanks the alias name instead of the colum name
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
static modify($p_id, $p_javascript)
Display the icon to modify a idem.
Inplace_edit class for ajax update of HtmlInput object.
abstract of the table operation_exercice_detail
abstract of the table public.operation_exercice
Special operations end or start of exercice.
static input_row(Operation_Exercice_Detail_SQL $operation_detail_sql)
input one row of operation_exercice
submit_transfer($ledger_id)
transfer to accountancy
transform($ledger_id)
Transform the data in table OPERATION_EXERCICE and OPERATION_EXERCICE_DETAIL into an array usable by ...
display_row($data, $row_tr=true)
let display one row
static input_source()
input the source of the data : folder, exercice, closing or opening operation
input_transfer()
input data for transfering
display_total($with_span=true)
display the balance (total) of the operation
get_operation_exercice_sql()
set_operation_exercice_sql(Operation_Exercice_SQL $operation_exercice_sql)
if(count($a_accounting)==0) $header
create_script($p_string)
create the HTML for adding the script tags around of the script