Plugins  LAST
 All Data Structures Files Functions Variables Pages
Public Member Functions
Modop_Operation Class Reference
Collaboration diagram for Modop_Operation:
Collaboration graph

Public Member Functions

 __construct ($p_cn, $p_id)
 
 format ()
 retrieve data from jrnx, jrn, quant_xxx and format them to usable for the acc_leger input function More...
 
 suspend_strict ()
 deactivate the strict mode More...
 
 activate_strict ()
 activate strict mode, only if $this->strict=true More...
 
 suspend_receipt ()
 deactivate the suggest mode for the receipt number, if More...
 
 activate_receipt ()
 activate receipt, only if $this->toggle=true More...
 

Detailed Description

Definition at line 27 of file class_modop_operation.php.

Constructor & Destructor Documentation

Modop_Operation::__construct (   $p_cn,
  $p_id 
)

Definition at line 29 of file class_modop_operation.php.

30  {
31  $this->db=$p_cn;
32  $this->jr_id=trim($p_id);
33  $this->array=array();
34  }

Member Function Documentation

Modop_Operation::activate_receipt ( )

activate receipt, only if $this->toggle=true

Deprecated:
See Also
suspend_receipt

Definition at line 249 of file class_modop_operation.php.

250  {
251  if ($this->toggle==true)
252  {
253  $owner=new Own($this->db);
254  $owner->MY_PJ_SUGGEST='Y';
255  $owner->save('MY_PJ_SUGGEST');
256  }
257  }
Modop_Operation::activate_strict ( )

activate strict mode, only if $this->strict=true

Deprecated:
See Also
suspend_receipt

Definition at line 226 of file class_modop_operation.php.

227  {
228  if ($this->strict==true)
229  {
230  $owner=new Own($this->db);
231  $owner->MY_STRICT='Y';
232  $owner->save('MY_STRICT');
233  }
234  }
Modop_Operation::format ( )

retrieve data from jrnx, jrn, quant_xxx and format them to usable for the acc_leger input function

See Also
Acc_Ledger::input(),Acc_Ledger_Purchase::input(),Acc_Ledger_Sold::input(),

Definition at line 40 of file class_modop_operation.php.

References $fcard, and jr_internal.

41  {
42  /* check if we retrieve it */
43  $this->ledger_type=$this->db->get_value("select jrn_def_type from jrn_def ".
44  " where jrn_def_id = (select jr_def_id from jrn where jr_id=$1)",
45  array($this->jr_id));
46  if ($this->ledger_type=='')
47  throw new Exception('Operation non trouvée');
48  /* ---------------------------------------------------------------------- */
49  // PURCHASE
50  /* ---------------------------------------------------------------------- */
51  if ( $this->ledger_type=='ACH')
52  {
53  $this->array['e_mp']=0;
54  $this->array['jrn_type']='ACH';
55  $jrn=$this->db->get_array("select jr_id,to_char(jr_date,'DD.MM.YYYY') as date_fmt,".
56  " to_char(jrn_ech,'DD.MM.YYYY') as ech_fmt,jr_comment,jr_pj_number,
57  jr_tech_per,jr_Def_id,jr_internal ".
58  " from jrn where jr_id=$1",
59  array($this->jr_id));
60  $this->jr_id=$jrn[0]['jr_id'];
61  $this->jr_internal=$jrn[0]['jr_internal'];
62  /* retrieve from jrn */
63  $this->array['e_ech']=$jrn[0]['ech_fmt'];
64  $this->array['e_date']=$jrn[0]['date_fmt'];
65  $this->array['e_comm']=$jrn[0]['jr_comment'];
66  $this->array['e_pj']=$jrn[0]['jr_pj_number'];
67  $this->array['p_jrn']=$jrn[0]['jr_def_id'];
68  $this->array['periode']=$jrn[0]['jr_tech_per'];
69 
70  /* retrieve from jrn_info */
71  $this->array['bon_comm']=$this->db->get_value("select ji_value from jrn_info where jr_id=$1 and id_type='BON_COMMANDE'",
72  array($this->jr_id));
73  $this->array['other_info']=$this->db->get_value("select ji_value from jrn_info where jr_id=$1 and id_type='OTHER'",
74  array($this->jr_id));
75  /* retrieve from quant_purchase */
76  $qp=$this->db->get_array("select * from quant_purchase where j_id in (select j_id from jrnx join jrn on (j_grpt = jr_grpt_id) where ".
77  " jr_id=$1)",array($this->jr_id));
78  /* check if "quick writing" was used */
79  if ( count($qp) == 0)
80  throw new Exception('Désolé cette opération a été faite en écriture directe');
81 
82  /* customer */
83  $fcard=new Fiche($this->db,$qp[0]['qp_supplier']);
84  $this->array['e_client']=$fcard->get_quick_code();
85  /* for each item */
86  for ($e=0; $e<count($qp); $e++)
87  {
88  $fcard=new Fiche($this->db,$qp[$e]['qp_fiche']);
89  $this->array['e_march'.$e]=$fcard->get_quick_code();;
90  $this->array['e_march'.$e.'_price']=round($qp[$e]['qp_price']/$qp[$e]['qp_quantite'],2);
91  $this->array['e_march'.$e.'_tva_amount']=$qp[$e]['qp_vat'];
92  $this->array['e_march'.$e.'_tva_id']=$qp[$e]['qp_vat_code'];
93  $this->array['e_quant'.$e]=$qp[$e]['qp_quantite'];
94 
95 
96  } // for each item
97  $this->array['nb_item']=(count($qp)<MAX_ARTICLE)?MAX_ARTICLE:count($qp);
98  } // ledger ACH
99  /* ---------------------------------------------------------------------- */
100  // VEN
101  /* ---------------------------------------------------------------------- */
102  if ( $this->ledger_type=='VEN')
103  {
104  $this->array['e_mp']=0;
105  $this->array['jrn_type']='VEN';
106  $jrn=$this->db->get_array("select jr_id,
107  to_char(jr_date,'DD.MM.YYYY') as date_fmt,
108  to_char(jrn_ech,'DD.MM.YYYY') as ech_fmt,
109  jr_comment,jr_pj_number,
110  jr_tech_per,jr_Def_id,jr_internal
111  from jrn where jr_id=$1",
112  array($this->jr_id));
113  $this->jr_id=$jrn[0]['jr_id'];
114  $this->jr_internal=$jrn[0]['jr_internal'];
115  /* retrieve from jrn */
116  $this->array['e_ech']=$jrn[0]['ech_fmt'];
117  $this->array['e_date']=$jrn[0]['date_fmt'];
118  $this->array['e_comm']=$jrn[0]['jr_comment'];
119  $this->array['e_pj']=$jrn[0]['jr_pj_number'];
120  $this->array['p_jrn']=$jrn[0]['jr_def_id'];
121  $this->array['periode']=$jrn[0]['jr_tech_per'];
122 
123  /* retrieve from jrn_info */
124  $this->array['bon_comm']=$this->db->get_value("select ji_value from jrn_info where jr_id=$1 and id_type='BON_COMMANDE'",
125  array($this->jr_id));
126  $this->array['other_info']=$this->db->get_value("select ji_value from jrn_info where jr_id=$1 and id_type='OTHER'",
127  array($this->jr_id));
128  /* retrieve from quant_purchase */
129  $qp=$this->db->get_array("select * from quant_sold where j_id in (select j_id from jrnx join jrn on (j_grpt = jr_grpt_id) where ".
130  " jr_id=$1)",array($this->jr_id));
131  if ( count($qp) == 0)
132  throw new Exception('Désolé cette opération a été faite en écriture directe');
133  /* customer */
134  $fcard=new Fiche($this->db,$qp[0]['qs_client']);
135  $this->array['e_client']=$fcard->get_quick_code();
136 
137 
138  /* for each item */
139  for ($e=0; $e<count($qp); $e++)
140  {
141  $fcard=new Fiche($this->db,$qp[$e]['qs_fiche']);
142  $this->array['e_march'.$e]=$fcard->get_quick_code();;
143  $this->array['e_march'.$e.'_price']=round($qp[$e]['qs_price']/$qp[$e]['qs_quantite'],2);
144  $this->array['e_march'.$e.'_tva_amount']=$qp[$e]['qs_vat'];
145  $this->array['e_march'.$e.'_tva_id']=$qp[$e]['qs_vat_code'];
146  $this->array['e_quant'.$e]=$qp[$e]['qs_quantite'];
147 
148 
149  } // for each item
150  $this->array['nb_item']=(count($qp)<MAX_ARTICLE)?MAX_ARTICLE:count($qp);
151 
152  } // ledger VEN
153  /* ---------------------------------------------------------------------- */
154  // MISC
155  /* ---------------------------------------------------------------------- */
156  if ( $this->ledger_type=='ODS')
157  {
158  $this->array['e_mp']=0;
159  $this->array['jrn_type']='ODS';
160  $jrn=$this->db->get_array("select jr_id,jr_internal,to_char(jr_date,'DD.MM.YYYY') as date_fmt,jr_comment,jr_pj_number, jr_tech_per,jr_Def_id from jrn where jr_id=$1",
161  array($this->jr_id));
162  $this->jr_id=$jrn[0]['jr_id'];
163  $this->jr_internal=$jrn[0]['jr_internal'];
164  /* retrieve from jrn */
165  $this->array['e_date']=$jrn[0]['date_fmt'];
166  $this->array['desc']=$jrn[0]['jr_comment'];
167  $this->array['e_pj']=$jrn[0]['jr_pj_number'];
168  $this->array['p_jrn']=$jrn[0]['jr_def_id'];
169  $this->array['periode']=$jrn[0]['jr_tech_per'];
170  $ods=$this->db->get_array('select j_qcode,j_poste,j_text,j_montant,j_debit from jrnx where j_grpt = (select jr_grpt_id from jrn where jr_id=$1)',
171  array($this->jr_id));
172  for ($e=0; $e<count($ods); $e++)
173  {
174  $this->array['qc_'.$e]=$ods[$e]['j_qcode'];
175  $this->array['poste'.$e]=(trim($ods[$e]['j_qcode'])=='')?$ods[$e]['j_poste']:'';
176  if ( $ods[$e]['j_debit']=='t' )
177  $this->array['ck'.$e]=true;
178  $this->array['amount'.$e]=$ods[$e]['j_montant'];
179  $this->array['ld'.$e]=$ods[$e]['j_text'];
180  }
181  $this->array['nb_item']=(count($ods)<MAX_ARTICLE)?MAX_ARTICLE:count($ods);
182 
183  } // ledger MISC
184 ///////////////////////////////////////////////////////////////////////////
185 // FIN
186 ///////////////////////////////////////////////////////////////////////////
187  if ( $this->ledger_type=="FIN")
188  {
189  $jrn=$this->db->get_array("select jr_id,to_char(jr_date,'DD.MM.YYYY') as date_fmt,to_char(jrn_ech,'DD.MM.YYYY') as ech_fmt,jr_comment,jr_pj_number, jr_tech_per,jr_Def_id from jrn where jr_id=$1",
190  array($this->jr_id));
191  /* retrieve from jrn */
192  $this->jr_id=$jrn[0]['jr_id'];
193  $this->array['e_date']=$jrn[0]['date_fmt'];
194  $this->array['e_comm']=$jrn[0]['jr_comment'];
195  $this->array['e_pj']=$jrn[0]['jr_pj_number'];
196  $this->array['p_jrn']=$jrn[0]['jr_def_id'];
197  $this->array['period']=$jrn[0]['jr_tech_per'];
198  /* retrieve from quant_purchase */
199  $qp=$this->db->get_array("select * from quant_fin where jr_id =$1",array($this->jr_id));
200  /* check if "quick writing" was used */
201  if ( count($qp) == 0)
202  throw new Exception('Désolé cette opération ne peut être corrigée');
203  /* bank */
204  $fcard=new Fiche($this->db,$qp[0]['qf_bank']);
205  $this->array['e_bank']=$fcard->get_quick_code();
206  /* other */
207  $fcard=new Fiche($this->db,$qp[0]['qf_other']);
208  $this->array['e_other']=$fcard->get_quick_code();
209  $this->array['e_amount']=$qp[0]['qf_amount'];
210  }
211  } // end function format()
if($p_number->value==0) l les annuités seront recalculées et l pct[] ad_year[] select jr_internal
$fcard
Open the file and parse it.
Definition: test_file.php:26
Modop_Operation::suspend_receipt ( )

deactivate the suggest mode for the receipt number, if

Definition at line 238 of file class_modop_operation.php.

References $g_parameter.

239  {
240  global $g_parameter;
241  $g_parameter->MY_PJ_SUGGEST='N';
242  $this->toggle=false;
243  }
global $g_parameter
Definition: ajax.php:27
Modop_Operation::suspend_strict ( )

deactivate the strict mode

Definition at line 215 of file class_modop_operation.php.

References $g_parameter.

216  {
217  global $g_parameter;
218  $g_parameter->MY_STRICT='N';
219  $this->strict=false;
220  }
global $g_parameter
Definition: ajax.php:27

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