Lettering for account and card are now finished
This commit is contained in:
parent
e9c45e6190
commit
f00f8ffe0b
7 changed files with 454 additions and 58 deletions
|
|
@ -195,49 +195,122 @@ EOF;
|
|||
/**
|
||||
*display the lettering
|
||||
*/
|
||||
case 'dl':
|
||||
require_once('class_lettering.php');
|
||||
$ret=new IButton('return');
|
||||
$ret->label=_('Retour');
|
||||
$ret->javascript="$('detail').hide();$('list').show();";
|
||||
$r="";
|
||||
// retrieve info for the given j_id (date, amount,side and comment)
|
||||
$sql="select j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,J_POSTE,j_qcode,
|
||||
case 'dl':
|
||||
require_once('class_lettering.php');
|
||||
$exercice=$user->get_exercice();
|
||||
$periode=new Periode($cn);
|
||||
list($first_per,$last_per)=$periode->get_limit($exercice);
|
||||
|
||||
$ret=new IButton('return');
|
||||
$ret->label=_('Retour');
|
||||
$ret->javascript="$('detail').hide();$('list').show();$('search').show();";
|
||||
$r="";
|
||||
// retrieve info for the given j_id (date, amount,side and comment)
|
||||
$sql="select j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,J_POSTE,j_qcode,
|
||||
jr_comment,j_montant, j_debit,jr_internal from jrnx join jrn on (j_grpt=jr_grpt_id)
|
||||
where j_id=$1";
|
||||
$arow=$cn->get_array($sql,array($j_id));
|
||||
$row=$arow[0];
|
||||
$arow=$cn->get_array($sql,array($j_id));
|
||||
$row=$arow[0];
|
||||
|
||||
$r.='<fieldset><legend>'._('Lettrage').'</legend>';
|
||||
$r.='Poste '.$row['j_poste'].' '.$row['j_qcode'].'<br>';
|
||||
$r.='Date : '.$row['j_date_fmt'].' ref :'.$row['jr_internal'].' <br> ';
|
||||
$r.=h($row['jr_comment'])." montant: ".($row['j_montant'])." -- ".(($row['j_debit']=='t')?'D':'C');
|
||||
$r.='</fieldset>';
|
||||
|
||||
// display a list of operation from the other side + box button
|
||||
if ( $ot == 'account') {
|
||||
$obj=new Lettering_Account($cn,$row['j_poste']);
|
||||
$r.=$obj->show_letter($j_id);
|
||||
} else if ($ot=='card') {
|
||||
$obj=new Lettering_Card($cn,$row['j_qcode']);
|
||||
$r.=$obj->show_letter($j_id);
|
||||
} else {
|
||||
$r.='Mauvais type objet';
|
||||
}
|
||||
$html='<FORM METHOD="post">';
|
||||
$html.=HtmlInput::phpsessid();
|
||||
$html.=dossier::hidden();
|
||||
if ( isset($_REQUEST['p_action'])) $html.=HtmlInput::hidden('p_action',$_REQUEST['p_action']);
|
||||
if ( isset($_REQUEST['sa'])) $html.=HtmlInput::hidden('sa',$_REQUEST['sa']);
|
||||
if ( isset($_REQUEST['acc'])) $html.=HtmlInput::hidden('acc',$_REQUEST['acc']);
|
||||
$r.='<fieldset><legend>'._('Lettrage').'</legend>';
|
||||
$r.='Poste '.$row['j_poste'].' '.$row['j_qcode'].'<br>';
|
||||
$r.='Date : '.$row['j_date_fmt'].' ref :'.$row['jr_internal'].' <br> ';
|
||||
$r.=h($row['jr_comment'])." montant: ".($row['j_montant'])." ".(($row['j_debit']=='t')?'D':'C');
|
||||
$r.='</fieldset>';
|
||||
$r.='<div id="filtre" style="float:left;display:block">';
|
||||
$r.='<form method="get" id="search_form" onsubmit="search_letter(this);return false">';
|
||||
$r.='<div style="float:left;">';
|
||||
// needed hidden var
|
||||
$r.=HtmlInput::phpsessid();
|
||||
$r.=dossier::hidden();
|
||||
if ( isset($_REQUEST['p_action'])) $r.=HtmlInput::hidden('p_action',$_REQUEST['p_action']);
|
||||
if ( isset($_REQUEST['sa'])) $r.=HtmlInput::hidden('sa',$_REQUEST['sa']);
|
||||
if ( isset($_REQUEST['acc'])) $r.=HtmlInput::hidden('acc',$_REQUEST['acc']);
|
||||
$r.=HtmlInput::hidden('j_id',$j_id);
|
||||
$r.=HtmlInput::hidden('op',$op);
|
||||
$r.=HtmlInput::hidden('ot',$ot);
|
||||
|
||||
$html.=$r;
|
||||
$html.=HtmlInput::submit('record',_('Sauver')).$ret->input();
|
||||
$html.='</FORM>';
|
||||
// echo $html;exit;
|
||||
$html=escape_xml($html);
|
||||
$r.='<table>';
|
||||
//min amount
|
||||
$line=td(_('Montant min. '));
|
||||
$min=new INum('min_amount');
|
||||
$min->value=(isset($min_amount))?$min_amount:0;
|
||||
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
$line.=td($min->input());
|
||||
// max amount
|
||||
$line.=td(_('Montant max. '));
|
||||
$max=new INum('max_amount');
|
||||
$max->value=(isset($max_amount))?$max_amount:0;
|
||||
$line.=td($max->input());
|
||||
$r.=tr($line);
|
||||
|
||||
// start date
|
||||
$start=new IDate('search_start');
|
||||
$start->value=(isset($search_start))?$search_start:$first_per->first_day();
|
||||
|
||||
|
||||
$line=td('Date Debut').td($start->input());
|
||||
// end date
|
||||
$end=new IDate('search_end');
|
||||
$end->value=(isset($search_end))?$search_end:$last_per->last_day();
|
||||
$line.=td('Date Fin').td($end->input());
|
||||
$r.=tr($line);
|
||||
// Side
|
||||
$line=td('Debit / Credit');
|
||||
$iside=new ISelect('side');
|
||||
$iside->value=array(
|
||||
array('label'=>_('Debit'),'value'=>0),
|
||||
array('label'=>_('Credit'),'value'=>1),
|
||||
array('label'=>_('Les 2'),'value'=>3)
|
||||
);
|
||||
$iside->selected=(isset($side))?$side:0;
|
||||
$r.=tr($line.td($iside->input()));
|
||||
$r.='</table>';
|
||||
$r.='</div>';
|
||||
$r.='<div style="float:left;padding-left:100">';
|
||||
$r.=HtmlInput::submit('search','Rechercher');
|
||||
$r.='</div>';
|
||||
$r.='</form>';
|
||||
$r.='</div>';
|
||||
|
||||
$form='<div id="result" style="float:top;clear:both">';
|
||||
|
||||
$form.='<FORM METHOD="post">';
|
||||
$form.=HtmlInput::phpsessid();
|
||||
$form.=dossier::hidden();
|
||||
if ( isset($_REQUEST['p_action'])) $form.=HtmlInput::hidden('p_action',$_REQUEST['p_action']);
|
||||
if ( isset($_REQUEST['sa'])) $form.=HtmlInput::hidden('sa',$_REQUEST['sa']);
|
||||
if ( isset($_REQUEST['acc'])) $form.=HtmlInput::hidden('acc',$_REQUEST['acc']);
|
||||
// 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;
|
||||
|
||||
$form.=$obj->show_letter($j_id);
|
||||
} else if ($ot=='card') {
|
||||
$obj=new Lettering_Card($cn,$row['j_qcode']);
|
||||
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;
|
||||
$form.=$obj->show_letter($j_id);
|
||||
} else {
|
||||
$form.='Mauvais type objet';
|
||||
}
|
||||
|
||||
$form.=HtmlInput::submit('record',_('Sauver')).$ret->input();
|
||||
$form.='</FORM>';
|
||||
$form.='</div>';
|
||||
$html=$r.$form;
|
||||
// echo $html;exit;
|
||||
$html=escape_xml($html);
|
||||
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
echo <<<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data>
|
||||
|
|
@ -245,6 +318,5 @@ echo <<<EOF
|
|||
<value>$html</value>
|
||||
</data>
|
||||
EOF;
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -493,6 +493,7 @@ function dsp_letter(obj) {
|
|||
}
|
||||
);
|
||||
$('list').hide();
|
||||
$('search').hide();
|
||||
$('detail').innerHTML='<img src="image/loading.gif">';
|
||||
$('detail').show();
|
||||
} catch(e){alert('dsp_letter '+e.message);}
|
||||
|
|
@ -519,4 +520,35 @@ function success_dsp_letter(req) {
|
|||
}
|
||||
function error_dsp_letter(req) {
|
||||
alert('Erreur AJAX DSP_LETTER');
|
||||
}
|
||||
}
|
||||
|
||||
function search_letter(obj) {
|
||||
try {
|
||||
var str_query='';
|
||||
if (obj.elements['gDossier'] ) str_query='gDossier='+obj.elements['gDossier'].value;
|
||||
if (obj.elements['phpsessid'] ) str_query+='&PHPSESSID='+obj.elements['phpsessid'].value;
|
||||
if (obj.elements['j_id'] ) str_query+='&j_id='+obj.elements['j_id'].value;
|
||||
if (obj.elements['ot'] ) str_query+='&ot='+obj.elements['ot'].value;
|
||||
if (obj.elements['op'] ) str_query+='&op='+obj.elements['op'].value;
|
||||
if (obj.elements['min_amount'] ) str_query+='&min_amount='+obj.elements['min_amount'].value;
|
||||
if (obj.elements['max_amount'] ) str_query+='&max_amount='+obj.elements['max_amount'].value;
|
||||
if (obj.elements['search_start'] ) str_query+='&search_start='+obj.elements['search_start'].value;
|
||||
if (obj.elements['search_end'] ) str_query+='&search_end='+obj.elements['search_end'].value;
|
||||
if (obj.elements['side'] ) str_query+='&side='+obj.elements['side'].value;
|
||||
|
||||
|
||||
var action=new Ajax.Request(
|
||||
"ajax_misc.php",
|
||||
{
|
||||
method:'get',
|
||||
parameters:str_query,
|
||||
onFailure:error_dsp_letter,
|
||||
onSuccess:success_dsp_letter
|
||||
}
|
||||
);
|
||||
$('list').hide();
|
||||
$('search').hide();
|
||||
$('detail').innerHTML='<img src="image/loading.gif">';
|
||||
$('detail').show();
|
||||
} catch(e){alert('search_letter '+e.message);}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,8 +105,10 @@ class Lettering
|
|||
@todo if only one row, we delete completely the lettering
|
||||
*/
|
||||
public function save($p_array) {
|
||||
$this->db->start();
|
||||
|
||||
$this->db->exec_sql('delete from jnt_letter where jl_id=$1',array($p_array['jnt_id']));
|
||||
|
||||
$this->db->start();
|
||||
$jl_id=$this->db->get_next_seq("jnt_letter_jl_id_seq");
|
||||
$this->db->exec_sql('insert into jnt_letter(jl_id) values($1)',
|
||||
array($jl_id));
|
||||
|
|
@ -119,22 +121,26 @@ class Lettering
|
|||
}else {
|
||||
$lc_id=$this->db->get_value('insert into letter_cred(j_id,jl_id) values($1,$2) returning lc_id',array($p_array['j_id'],$jl_id));
|
||||
}
|
||||
|
||||
$count=0;
|
||||
// save dest
|
||||
for($i=0;$i<count($p_array['letter_j_id']);$i++){
|
||||
if (isset($p_array['ck'.$i])) { //if 1
|
||||
// save the dest
|
||||
$deb=$this->db->get_value('select j_debit,j_montant from jrnx where j_id=$1',array($p_array['letter_j_id'][$i]));
|
||||
if ( $deb == 't') {
|
||||
$count++;
|
||||
// save into letter_deb
|
||||
$ld_id=$this->db->get_value('insert into letter_deb(j_id,jl_id) values($1,$2) returning ld_id',array($p_array['letter_j_id'][$i],$jl_id));
|
||||
}else {
|
||||
$count++;
|
||||
$lc_id=$this->db->get_value('insert into letter_cred(j_id,jl_id) values($1,$2) returning lc_id',array($p_array['letter_j_id'][$i],$jl_id));
|
||||
}
|
||||
} //end if 1
|
||||
} //end for
|
||||
// save into jnt_letter
|
||||
|
||||
if ( $count==0) {
|
||||
$this->db->rollback();
|
||||
}
|
||||
$this->db->commit();
|
||||
}
|
||||
/**
|
||||
|
|
@ -161,10 +167,6 @@ class Lettering
|
|||
);
|
||||
*/
|
||||
}
|
||||
protected function show_not_lettered() {
|
||||
}
|
||||
protected function show_lettered() {
|
||||
}
|
||||
protected function show_all() {
|
||||
$this->get_all();
|
||||
$r="";
|
||||
|
|
@ -174,13 +176,31 @@ class Lettering
|
|||
ob_clean();
|
||||
return $r;
|
||||
}
|
||||
protected function show_lettered() {
|
||||
$this->get_letter();
|
||||
$r="";
|
||||
ob_start();
|
||||
require_once('template/letter_all.php');
|
||||
$r=ob_get_contents();
|
||||
ob_clean();
|
||||
return $r;
|
||||
}
|
||||
protected function show_not_lettered() {
|
||||
$this->get_unletter();
|
||||
$r="";
|
||||
ob_start();
|
||||
require_once('template/letter_all.php');
|
||||
$r=ob_get_contents();
|
||||
ob_clean();
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function show_list($p_type) {
|
||||
switch($p_type) {
|
||||
case 'all':
|
||||
return $this->show_all();
|
||||
break;
|
||||
case 'notletter':
|
||||
case 'unletter':
|
||||
return $this->show_not_lettered();
|
||||
break;
|
||||
case 'letter':
|
||||
|
|
@ -193,9 +213,9 @@ class Lettering
|
|||
public function show_letter($p_jid) {
|
||||
$j_debit=$this->db->get_value('select j_Debit from jrnx where j_id=$1',array($p_jid));
|
||||
$amount_init=$this->db->get_value('select j_montant from jrnx where j_id=$1',array($p_jid));
|
||||
$this->get_other_side($j_debit);
|
||||
$this->get_filter();
|
||||
// retrieve jnt_letter.id
|
||||
$sql="select distinct(jl_id) from jnt_letter join letter_deb using (jl_id) join letter_cred using (jl_id)
|
||||
$sql="select distinct(jl_id) from jnt_letter left outer join letter_deb using (jl_id) left outer join letter_cred using (jl_id)
|
||||
where letter_deb.j_id = $1 or letter_cred.j_id=$2";
|
||||
$jnt_id=$this->db->get_value($sql,array($p_jid,$p_jid));
|
||||
|
||||
|
|
@ -210,6 +230,7 @@ class Lettering
|
|||
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function update() {
|
||||
if ( $this->verify() != 0 ) return;
|
||||
}
|
||||
|
|
@ -244,7 +265,7 @@ class Lettering_Account extends Lettering{
|
|||
*@brief get other side
|
||||
*@param $j_debit f for cred or t for debit
|
||||
*/
|
||||
public function get_other_side($j_debit) {
|
||||
public function get_other_side_obsolete($j_debit) {
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,
|
||||
|
|
@ -257,6 +278,43 @@ order by j_date,j_id";
|
|||
$this->content=$this->db->get_array($sql,array($this->account,$this->start,$this->end));
|
||||
}
|
||||
|
||||
public function get_filter() {
|
||||
$filter_deb='';
|
||||
if (isset($this->fil_deb)) {
|
||||
switch ($this->fil_deb) {
|
||||
case 0:
|
||||
$filter_deb=" and j_debit='t' ";
|
||||
break;
|
||||
case 1:
|
||||
$filter_deb=" and j_debit='f' ";
|
||||
break;
|
||||
case 2:
|
||||
$filter_deb=" ";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
$filter_amount="";
|
||||
if ( isset ($this->fil_amount_max ) &&
|
||||
isset ($this->fil_amount_min ) &&
|
||||
isNumber($this->fil_amount_max)==1 &&
|
||||
isNumber($this->fil_amount_min)==1 &&
|
||||
($this->fil_amount_max != 0 || $this->fil_amount_min != 0) )
|
||||
$filter_amount=" and j_montant between $this->fil_amount_min and $this->fil_amount_max ";
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
$filter_deb
|
||||
$filter_amount
|
||||
order by j_date,j_id";
|
||||
|
||||
$this->content=$this->db->get_array($sql,array($this->account,$this->start,$this->end));
|
||||
}
|
||||
|
||||
|
||||
public function get_all() {
|
||||
$sql="
|
||||
|
|
@ -267,6 +325,30 @@ coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
|||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->account,$this->start,$this->end));
|
||||
}
|
||||
public function get_letter() {
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
and j_id in (select j_id from letter_deb join jnt_letter using (jl_id) union select j_id from letter_cred join jnt_letter using (jl_id) )
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->account,$this->start,$this->end));
|
||||
}
|
||||
public function get_unletter() {
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
and j_id not in (select j_id from letter_deb join jnt_letter using (jl_id) union select j_id from letter_cred join jnt_letter using (jl_id) )
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->account,$this->start,$this->end));
|
||||
}
|
||||
|
|
@ -274,11 +356,84 @@ order by j_date,j_id";
|
|||
}
|
||||
|
||||
class Lettering_Card extends Lettering{
|
||||
function __construct($p_init,$p_account=null) {
|
||||
function __construct($p_init,$p_qcode=null) {
|
||||
parent::__construct($p_init);
|
||||
$this->qcode=$p_qcode;
|
||||
$this->quick_code=$p_qcode;
|
||||
$this->object_type='card';
|
||||
}
|
||||
|
||||
public function get_filter() {
|
||||
$filter_deb='';
|
||||
if (isset($this->fil_deb)) {
|
||||
switch ($this->fil_deb) {
|
||||
case 0:
|
||||
$filter_deb=" and j_debit='t' ";
|
||||
break;
|
||||
case 1:
|
||||
$filter_deb=" and j_debit='f' ";
|
||||
break;
|
||||
case 2:
|
||||
$filter_deb=" ";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
$filter_amount="";
|
||||
if ( isset ($this->fil_amount_max ) &&
|
||||
isset ($this->fil_amount_min ) &&
|
||||
isNumber($this->fil_amount_max)==1 &&
|
||||
isNumber($this->fil_amount_min)==1 &&
|
||||
($this->fil_amount_max != 0 || $this->fil_amount_min != 0) )
|
||||
$filter_amount=" and j_montant between $this->fil_amount_min and $this->fil_amount_max ";
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
$filter_deb
|
||||
$filter_amount
|
||||
order by j_date,j_id";
|
||||
|
||||
$this->content=$this->db->get_array($sql,array($this->quick_code,$this->start,$this->end));
|
||||
}
|
||||
public function get_all() {
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->quick_code,$this->start,$this->end));
|
||||
}
|
||||
|
||||
public function get_letter() {
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
and j_id in (select j_id from letter_deb join jnt_letter using (jl_id) union select j_id from letter_cred join jnt_letter using (jl_id) )
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->quick_code,$this->start,$this->end));
|
||||
}
|
||||
public function get_unletter() {
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
and j_id not in (select j_id from letter_deb join jnt_letter using (jl_id) union select j_id from letter_cred join jnt_letter using (jl_id) )
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->quick_code,$this->start,$this->end));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,5 +48,6 @@ if ($sa == 'poste') {
|
|||
}
|
||||
|
||||
if ($sa=='qc') {
|
||||
require_once('lettering.card.inc.php');
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ require_once('class_lettering.php');
|
|||
|
||||
echo IPoste::ipopup('ipop_account');
|
||||
echo '<div class="content">';
|
||||
|
||||
echo '<div id="search">';
|
||||
echo '<FORM METHOD="GET">';
|
||||
echo dossier::hidden();
|
||||
echo HtmlInput::phpsessid();
|
||||
|
|
@ -92,7 +92,7 @@ echo '</table>';
|
|||
echo '<br>';
|
||||
echo HtmlInput::submit("seek",_('Recherche'));
|
||||
echo '</FORM>';
|
||||
|
||||
echo '</div>';
|
||||
if (! isset($_REQUEST['seek'])) exit;
|
||||
echo '<hr>';
|
||||
//--------------------------------------------------------------------------------
|
||||
|
|
@ -113,6 +113,10 @@ $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');
|
||||
|
||||
echo '</div>';
|
||||
echo '<div id="detail" style="display:none">';
|
||||
|
|
|
|||
132
include/lettering.card.inc.php
Normal file
132
include/lettering.card.inc.php
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta 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.
|
||||
*
|
||||
* PhpCompta 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 PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/*!\file
|
||||
* \brief show the lettering by account
|
||||
*/
|
||||
echo js_include('prototype.js');
|
||||
echo js_include('scriptaculous.js');
|
||||
echo js_include('effects.js');
|
||||
echo js_include('controls.js');
|
||||
echo js_include('dragdrop.js');
|
||||
echo js_include('accounting_item.js');
|
||||
echo js_include('acc_ledger.js');
|
||||
require_once ('class_ipopup.php');
|
||||
require_once('class_lettering.php');
|
||||
echo JS_CARD;
|
||||
|
||||
|
||||
$search_card=new IPopup('ipop_card');
|
||||
$search_card->title=_('Recherche de fiche');
|
||||
$search_card->value='';
|
||||
echo $search_card->input();
|
||||
|
||||
echo '<div class="content">';
|
||||
echo '<div id="search">';
|
||||
echo '<FORM METHOD="GET">';
|
||||
echo dossier::hidden();
|
||||
echo HtmlInput::phpsessid();
|
||||
echo HtmlInput::hidden('p_action','let');
|
||||
echo HtmlInput::hidden('sa','qc');
|
||||
echo HtmlInput::hidden('p_jrn','0');
|
||||
echo '<table width="50%">';
|
||||
|
||||
$poste=new ICard('acc');
|
||||
$poste->name="acc";
|
||||
$poste->extra="all";
|
||||
$poste->set_attribute('popup','ipopcard');
|
||||
$poste->set_attribute('typecard','all');
|
||||
$poste->set_callback('filter_card');
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['acc'])) $poste->value=strtoupper(trim($_GET['acc']));
|
||||
$poste_span=new ISpan('account_label');
|
||||
$r= td(_('Lettrage pour la fiche ')).
|
||||
td($poste->input().$poste->search()).
|
||||
td($poste_span->input());
|
||||
echo tr($r);
|
||||
// limit of the year
|
||||
$exercice=$User->get_exercice();
|
||||
$periode=new Periode($cn);
|
||||
list($first_per,$last_per)=$periode->get_limit($exercice);
|
||||
|
||||
$start=new IDate('start');
|
||||
$start->value=(isset($_GET['start']))?$_GET['start']:$first_per->first_day();
|
||||
$r=td(_('Date début'));
|
||||
$r.=td($start->input());
|
||||
echo tr($r);
|
||||
|
||||
$end=new IDate('end');
|
||||
$end->value=(isset($_GET['end']))?$_GET['end']:$last_per->last_day();
|
||||
$r=td(_('Date fin'));
|
||||
$r.=td($end->input());
|
||||
echo tr($r);
|
||||
|
||||
// type of lettering : all, lettered, not lettered
|
||||
$sel=new ISelect('type_let');
|
||||
$sel->value=array(
|
||||
array('value'=>0,'label'=>_('Toutes opérations')),
|
||||
array('value'=>1,'label'=>_('Opérations lettrées')),
|
||||
array('value'=>2,'label'=>_('Opérations NON lettrées'))
|
||||
);
|
||||
if (isset($_GET['type_let'])) $sel->selected=$_GET['type_let'];
|
||||
|
||||
$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
|
||||
//--------------------------------------------------------------------------------
|
||||
echo '<div id="list">';
|
||||
$letter=new Lettering_Card($cn);
|
||||
$quick_code=strtoupper(trim($_GET['acc']));
|
||||
$letter->set_parameter('quick_code',$quick_code);
|
||||
$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');
|
||||
|
||||
echo '</div>';
|
||||
echo '<div id="detail" style="display:none">';
|
||||
echo '<IMG SRC=image/loading.gif>';
|
||||
echo '</div>';
|
||||
|
|
@ -60,7 +60,7 @@ $letter=($this->content[$i]['letter']==-1)?" ":$this->content[$i]['letter'];
|
|||
endfor;
|
||||
?>
|
||||
</TABLE>
|
||||
<h2 class="info2"><?=_('Total Debit')?> <?=$amount_deb?></h2>
|
||||
<h2 class="info2"><?=_('Total Credit')?> <?=$amount_cred?></h2>
|
||||
<span style="display:block;font-size:14px"><?=_('Total Debit')?> <?=$amount_deb?></span>
|
||||
<span style="display:block;font-size:14px"><?=_('Total Credit')?> <?=$amount_cred?></span>
|
||||
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue