noalyss Version-9
Public Member Functions
Lettering_Card Class Reference

only for operation retrieved thanks a quick_code manage the accounting entries for a given card More...

+ Inheritance diagram for Lettering_Card:
+ Collaboration diagram for Lettering_Card:

Public Member Functions

 __construct ($p_init, $p_qcode=null)
 constructor More...
 
 get_all ()
 fills this->content with all the operation for the this->quick_code(j_qcode) More...
 
 get_balance_ageing ($p_type)
 fill $this->content with the rows from this query Columns are More...
 
 get_filter ($p_jid=0)
 fills the this->content, datas are filtered thanks More...
 
 get_letter ()
 same as get_all but only for lettered operation More...
 
 get_letter_diff ()
 
 get_unletter ()
 same as get_all but only for unlettered operation More...
 
- Public Member Functions inherited from Lettering
 __construct ( $p_init)
 constructor More...
 
 delete ()
 
 get_info ()
 
 get_linked ($p_jlid)
 
 get_parameter ($p_string)
 
 insert ()
 
 insert_couple ($j_id1, $j_id2)
 Use to just insert a couple of lettered operation but do not make a link between operation. More...
 
 load ()
 
 remove_incoherent ()
 for some reason , sometimes, a record in letter_X doesn't have his counterpart in letter_Y More...
 
 save ($p_array)
 save from array, letter the accounting (or card) and create a link between operation More...
 
 seek ($cond, $p_array=null)
 retrieve * row thanks a condition More...
 
 set_parameter ($p_string, $p_value)
 
 show_letter ($p_jid)
 
 show_list ($p_type)
 wrapper : it call show_all, show_lettered or show_not_lettered depending of the parameter More...
 
 update ()
 
 verify ()
 

Additional Inherited Members

- Data Fields inherited from Lettering
 $db
 
 $end
 
 $sql_ledger
 
 $start
 
- Protected Member Functions inherited from Lettering
 show_all ()
 show all the record from jrnx and their status (linked or not) it fills the array $this->content More...
 
 show_lettered ()
 show only the lettered records from jrnx it fills the array $this->content More...
 
 show_lettered_diff ()
 show only the lettered records from jrnx it fills the array $this->content More...
 
 show_not_lettered ()
 show only the not lettered records from jrnx it fills the array $this->content More...
 
- Protected Attributes inherited from Lettering
 $variable
 

Detailed Description

only for operation retrieved thanks a quick_code manage the accounting entries for a given card

Definition at line 665 of file lettering.class.php.

Constructor & Destructor Documentation

◆ __construct()

Lettering_Card::__construct (   $p_init,
  $p_qcode = null 
)

constructor

Parameters
$p_initdb resource
$p_qcodequick_code of the jrnx.j_id

Definition at line 673 of file lettering.class.php.

674 {
675 parent::__construct($p_init);
676 $this->quick_code=$p_qcode;
677 $this->object_type='card';
678 }

Member Function Documentation

◆ get_all()

Lettering_Card::get_all ( )

fills this->content with all the operation for the this->quick_code(j_qcode)

Definition at line 743 of file lettering.class.php.

744 {
745 $sql="
746 with let_diff as (select jl_id,deb_amount-cred_amount as diff_letter1
747 from
748 ( select jl_id,coalesce(sum(j_montant),0) as cred_amount from letter_cred join jrnx using (j_id) group by jl_id) as CRED
749 left join (select jl_id,coalesce(sum(j_montant),0) as deb_amount from letter_deb join jrnx using (j_id) group by jl_id) as DEB using (jl_id)) ,
750 letter_jl as (select jl_id,j_id from letter_cred union all select jl_id,j_id from letter_deb)
751 select DISTINCT j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
752 j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
753 coalesce(let_diff.jl_id,-1) as letter,
754 diff_letter1 as letter_diff,
755 round(j_montant/currency_rate,4) as currency_amount,
756 currency_rate,
757 currency_id,
758 currency_rate_ref,
759 (select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
760 from jrnx join jrn on (j_grpt = jr_grpt_id)
761 left join letter_jl using (j_id)
762 left join let_diff using (jl_id)
763 where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
764 and $this->sql_ledger
765
766 order by j_date,j_id";
767 $this->content=$this->db->get_array($sql, array($this->quick_code, $this->start, $this->end));
768 }
else $card content[$j]['j_montant']
$SecUser db

References $sql, content, and db.

◆ get_balance_ageing()

Lettering_Card::get_balance_ageing (   $p_type)

fill $this->content with the rows from this query Columns are

  • j_id, id of jrnx
  • j_date, date opeation (yyyy.mm.dd)
  • to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
  • jr_pj_number, receipt number
  • j_montant, amount of the rows
  • j_debit, Debit or credit
  • jr_comment, label of the operation
  • jr_internal, internal number
  • jr_id, id of jrn
  • jr_def_id, id of the ledger (jrn_def.jrn_def_id)
  • coalesce(let_diff.jl_id,-1) as letter, id of the lettering , -1 means unlettered
  • diff_letter1 as letter_diff, delta between lettered operation
  • extract ('days' from coalesce(jr_date_paid,now())-coalesce(jr_ech,jr_date)) as day_paid, days between operation and payment
  • jd1.jrn_def_type type of the ledger (FIN, ODS,VEN or ACH)
Parameters
type$p_typevalue is unlet for unlettered operation or let for everything

Definition at line 870 of file lettering.class.php.

871 {
872 $sql_let=($p_type=='unlet')?' let_diff.jl_id is null and':'';
873 $sql=" with let_diff as (select jl_id,deb_amount-cred_amount as diff_letter1
874 from
875 ( select jl_id,coalesce(sum(j_montant),0) as cred_amount from letter_cred join jrnx using (j_id) group by jl_id) as CRED
876 left join (select jl_id,coalesce(sum(j_montant),0) as deb_amount from letter_deb join jrnx using (j_id) group by jl_id) as DEB using (jl_id)) ,
877 letter_jl as (select jl_id,j_id from letter_cred union all select jl_id,j_id from letter_deb)
878 select DISTINCT j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
879 j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
880 coalesce(let_diff.jl_id,-1) as letter,
881 diff_letter1 as letter_diff,
882 extract ('days' from coalesce(jr_date_paid,now())-jr_date) as day_paid,
883 jd1.jrn_def_type
884 from jrnx join jrn on (j_grpt = jr_grpt_id)
885 join jrn_def as jd1 on (jrn.jr_def_id=jd1.jrn_def_id)
886 left join letter_jl using (j_id)
887 left join let_diff using (jl_id)
888 where
889 {$sql_let}
890 j_qcode = upper($1)
891 and j_date >= to_date($2,'DD.MM.YYYY')
892 and {$this->sql_ledger}
893 and jrn_def_type in ('VEN','ACH')
894 order by j_date,j_id";
895 $this->content=$this->db->get_array($sql, array($this->quick_code, $this->start));
896 }

References $p_type, $sql, content, and db.

◆ get_filter()

Lettering_Card::get_filter (   $p_jid = 0)

fills the this->content, datas are filtered thanks

  • fil_deb poss values t (debit), f(credit), ' ' (everything)
  • fil_amount_max max amount
  • fil_amount_min min amount
  • $this->start min date
  • $this->end max date
  • this->quick_code: quick_code

Definition at line 689 of file lettering.class.php.

690 {
691 $filter_deb='';
692 if (isset($this->fil_deb))
693 {
694 switch ($this->fil_deb)
695 {
696 case 0:
697 $filter_deb=" and j_debit='t' ";
698 break;
699 case 1:
700 $filter_deb=" and j_debit='f' ";
701 break;
702 case 2:
703 $filter_deb=" ";
704 break;
705 }
706 }
707 $filter_amount="";
708 if (isset($this->fil_amount_max)&&
709 isset($this->fil_amount_min)&&
710 isNumber($this->fil_amount_max)==1&&
711 isNumber($this->fil_amount_min)==1&&
712 ($this->fil_amount_max!=0||$this->fil_amount_min!=0))
713 $filter_amount=" and (j_montant between $this->fil_amount_min and $this->fil_amount_max or (coalesce(comptaproc.get_letter_jnt($p_jid),-1)= coalesce(comptaproc.get_letter_jnt(j_id),-1) and coalesce(comptaproc.get_letter_jnt($p_jid),-1) <> -1 )) ";
714 $sql="
715 with let_diff as (select jl_id,deb_amount-cred_amount as diff_letter1
716 from
717 ( select jl_id,coalesce(sum(j_montant),0) as cred_amount from letter_cred join jrnx using (j_id) group by jl_id) as CRED
718 left join (select jl_id,coalesce(sum(j_montant),0) as deb_amount from letter_deb join jrnx using (j_id) group by jl_id) as DEB using (jl_id)) ,
719 letter_jl as (select jl_id,j_id from letter_cred union all select jl_id,j_id from letter_deb)
720 select distinct j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
721 j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
722 coalesce(let_diff.jl_id,-1) as letter,
723 diff_letter1 as letter_diff,
724 round(j_montant/currency_rate,4) as currency_amount,
725 currency_rate,
726 currency_rate_ref,
727 (select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
728 from jrnx join jrn on (j_grpt = jr_grpt_id)
729 left join letter_jl using (j_id)
730 left join let_diff using (jl_id)
731 where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
732 and $this->sql_ledger
733 $filter_deb
734 $filter_amount
735 order by j_date,j_id";
736
737 $this->content=$this->db->get_array($sql, array($this->quick_code, $this->start, $this->end));
738 }
isNumber($p_int)
Definition: ac_common.php:215

References $sql, content, db, and isNumber().

+ Here is the call graph for this function:

◆ get_letter()

Lettering_Card::get_letter ( )

same as get_all but only for lettered operation

Definition at line 773 of file lettering.class.php.

774 {
775 $sql="
776 with let_diff as (select jl_id,deb_amount-cred_amount as diff_letter1
777 from
778 ( select jl_id,coalesce(sum(j_montant),0) as cred_amount from letter_cred join jrnx using (j_id) group by jl_id) as CRED
779 left join (select jl_id,coalesce(sum(j_montant),0) as deb_amount from letter_deb join jrnx using (j_id) group by jl_id) as DEB using (jl_id)) ,
780 letter_jl as (select jl_id,j_id from letter_cred union all select jl_id,j_id from letter_deb)
781 select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
782 j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
783 let_diff.jl_id as letter,
784 diff_letter1 as letter_diff,
785 round(j_montant/currency_rate,4) as currency_amount,
786 currency_rate,
787 currency_id,
788 currency_rate_ref,
789 (select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
790 from jrnx join jrn on (j_grpt = jr_grpt_id)
791 join letter_jl using (j_id)
792 left join let_diff using (jl_id)
793 where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
794 and $this->sql_ledger
795 order by j_date,j_id";
796 $this->content=$this->db->get_array($sql, array($this->quick_code, $this->start, $this->end));
797 }

References $sql, content, and db.

◆ get_letter_diff()

Lettering_Card::get_letter_diff ( )

Definition at line 799 of file lettering.class.php.

800 {
801 $sql="
802 with let_diff as (select jl_id,deb_amount-cred_amount as diff_letter1
803 from
804 ( select jl_id,coalesce(sum(j_montant),0) as cred_amount from letter_cred join jrnx using (j_id) group by jl_id) as CRED
805 left join (select jl_id,coalesce(sum(j_montant),0) as deb_amount from letter_deb join jrnx using (j_id) group by jl_id) as DEB using (jl_id)) ,
806 letter_jl as (select jl_id,j_id from letter_cred union all select jl_id,j_id from letter_deb)
807 select distinct j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
808 j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
809 let_diff.jl_id as letter,
810 diff_letter1 as letter_diff,
811 round(j_montant/currency_rate,4) as currency_amount,
812 currency_id,
813 currency_rate,
814 currency_rate_ref,
815 (select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
816 from jrnx join jrn on (j_grpt = jr_grpt_id)
817 left join letter_jl using (j_id)
818 left join let_diff using (jl_id)
819 where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
820 and $this->sql_ledger
821 and diff_letter1 <>0
822 order by j_date,j_id";
823 $this->content=$this->db->get_array($sql, array($this->quick_code, $this->start, $this->end));
824 }

References $sql, content, and db.

◆ get_unletter()

Lettering_Card::get_unletter ( )

same as get_all but only for unlettered operation

Definition at line 829 of file lettering.class.php.

830 {
831 $sql="
832 select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
833 j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
834 -1 as letter,
835 0 as letter_diff,
836 round(j_montant/currency_rate,4) as currency_amount,
837 currency_id,
838 currency_rate,
839 currency_rate_ref,
840 (select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
841 from jrnx join jrn on (j_grpt = jr_grpt_id)
842 where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
843 and $this->sql_ledger
844 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) )
845 order by j_date,j_id";
846 $this->content=$this->db->get_array($sql, array($this->quick_code, $this->start, $this->end));
847 }

References $sql, content, and db.


The documentation for this class was generated from the following file: