/** *@brief retrieve data from the table QUANT_* *@return return an object or null if there is no * data from the QUANT table *@see Acc_Sold Acc_Purchase Acc_Fin Acc_Detail Acc_Misc */ function get_quant() { $ledger_id = $this->get_ledger(); if ($ledger_id == '') { throw new Exception(_('Journal non trouvé')); } $oledger = new Acc_Ledger($this->db, $ledger_id); // retrieve info from jrn_info switch ($oledger->get_type()) { case 'VEN': $ret = new Acc_Sold($this->db, $this->jr_id); break; case 'ACH': $ret = new Acc_Purchase($this->db, $this->jr_id); break; case 'FIN': $ret = new Acc_Fin($this->db, $this->jr_id); break; default: $ret = new Acc_Misc($this->db, $this->jr_id); break; } $ret->get(); if (empty($ret->det->array)) { $ret = new Acc_Misc($this->db, $this->jr_id); $ret->get(); } $ret->get_info(); return $ret; }