/** * @brief try to letter same card between $p_jrid and $this->jr_id * @param jrn.jr_id $p_jrid the operation to reconcile */ function auto_letter($p_jrid) { // Try to find same card from both operation $sql = "select j1.f_id as fiche ,coalesce(j1.j_id,-1) as jrnx_id1,coalesce(j2.j_id,-1) as jrnx_id2,\nj1.j_poste as poste\n\t\t\t\tfrom jrnx as j1\n\t\t\t\t\tjoin jrn as jr1 on (j1.j_grpt=jr1.jr_grpt_id)\n\t\t\t\t\tjoin jrnx as j2 on (coalesce(j1.f_id,-1)=coalesce(j2.f_id,-1) and j1.j_poste=j2.j_poste)\n\t\t\t\t\tjoin jrn as jr2 on (j2.j_grpt=jr2.jr_grpt_id)\n\t\t\t\twhere\n\t\t\t\t\tjr1.jr_id=\$1\n\t\t\t\t\tand\n\t\t\t\t\tjr2.jr_id= \$2"; $result = $this->db->get_array($sql, array($this->jr_id, $p_jrid)); if (count($result) == 0) { return; } for ($i = 0; $i < count($result); $i++) { if ($result[$i]['fiche'] != -1) { $letter = new Lettering_Card($this->db); $letter->insert_couple($result[$i]['jrnx_id1'], $result[$i]['jrnx_id2']); } else { $letter = new Lettering_Account($this->db); $letter->insert_couple($result[$i]['jrnx_id1'], $result[$i]['jrnx_id2']); } } }
//-------------------------------------------------------------------------------- // record the data //-------------------------------------------------------------------------------- if (isset($_POST['record'])) { $letter = new Lettering_Account($cn); $letter->save($_POST); } //-------------------------------------------------------------------------------- // Show the result //-------------------------------------------------------------------------------- echo '<div id="list">'; if (isDate($_GET['start']) == null || isDate($_GET['end']) == null) { echo alert(_('Date malformée, désolé')); return; } $letter = new Lettering_Account($cn); $letter->set_parameter('account', $_GET['acc']); $letter->set_parameter('start', $_GET['start']); $letter->set_parameter('end', $_GET['end']); if ($sel->selected == 0) { echo $letter->show_list('all'); } if ($sel->selected == 1) { echo $letter->show_list('letter'); } if ($sel->selected == 2) { echo $letter->show_list('unletter'); } if ($sel->selected == 3) { echo $letter->show_list('letter_diff'); }
$sel->selected = 1; } $r = td("Filtre ") . td($sel->input()); echo tr($r); echo '</table>'; echo '<br>'; echo HtmlInput::submit("seek", _('Recherche')); echo '</FORM>'; echo '</div>'; //if (! isset($_REQUEST['seek'])) exit; echo '<hr>'; //-------------------------------------------------------------------------------- // record the data //-------------------------------------------------------------------------------- if (isset($_POST['record'])) { $letter = new Lettering_Account($cn); $letter->save($_POST); } //-------------------------------------------------------------------------------- // Show the result //-------------------------------------------------------------------------------- if (isset($_GET['start']) && isset($_GET['end'])) { if (isDate($_GET['start']) == null || isDate($_GET['end']) == null) { echo alert(_('Date malformée, désolé')); return; } } echo '<div id="list">'; $fiche = new Fiche($cn, $_REQUEST['f_id']); $quick_code = $fiche->get_quick_code(); $letter = new Lettering_Card($cn);
} if (isset($_REQUEST['acc'])) { $form .= HtmlInput::hidden('acc', $_REQUEST['acc']); } if (isset($_REQUEST['sc'])) { $form .= HtmlInput::hidden('sc', $_REQUEST['sc']); } if (isset($_REQUEST['sb'])) { $form .= HtmlInput::hidden('sb', $_REQUEST['sb']); } if (isset($_REQUEST['f_id'])) { $form .= HtmlInput::hidden('f_id', $_REQUEST['f_id']); } // display a list of operation from the other side + box button if ($ot == 'account') { $obj = new Lettering_Account($cn, $row['j_poste']); if (isset($search_start)) { $obj->start = $search_start; } if (isset($search_end)) { $obj->end = $search_end; } if (isset($max_amount)) { $obj->fil_amount_max = $max_amount; } if (isset($min_amount)) { $obj->fil_amount_min = $min_amount; } if (isset($side)) { $obj->fil_deb = $side; }