示例#1
0
 /**
  * Calcul du montant de la retrocession pour la facture
  *
  * @return boolean
  **/
 function updateMontantRetrocession()
 {
     $this->_montant_retrocession = 0;
     $this->loadRefPraticien();
     $this->loadRefsItems();
     $retrocessions = $this->_ref_praticien->loadRefsRetrocessions();
     $add_anesth = true;
     $use_pm = false;
     foreach ($this->_ref_items as $item) {
         foreach ($retrocessions as $retro) {
             if ($retro->use_pm && $retro->code_class == $item->type && $retro->code == $item->code && $retro->active) {
                 $use_pm = true;
             }
         }
     }
     foreach ($this->_ref_items as $item) {
         $modif = false;
         if (!(!$add_anesth && $item->type == "CActeTarmed" && strstr($item->code, "28."))) {
             foreach ($retrocessions as $retro) {
                 /** @var CRetrocession $retro*/
                 if ($retro->code_class == $item->type && $retro->code == $item->code && $retro->active) {
                     $modif = true;
                     $montant = $item->quantite * $retro->updateMontant();
                     if (!$retro->use_pm && $item->type == "CActeTarmed" && $use_pm) {
                         $montant = 0;
                     }
                     if ($item->type == "CActeTarmed" && strstr($item->code, "28.")) {
                         $add_anesth = false;
                     }
                     $this->_montant_retrocession += $montant;
                     $this->_retrocessions[$item->code] = array($item->_montant_facture, $montant);
                 }
             }
             if (!$modif && ($item->type == "CActeTarmed" || $item->type == "CActeCaisse") && !$use_pm) {
                 /* @var CActeTarmed $code */
                 $code = new $item->type();
                 $code->code = $item->code;
                 $code->updateMontantBase();
                 $montant = 0.0;
                 if ($item->type == "CActeTarmed" && !strstr($item->code, "28.") && !strstr($item->code, "35.")) {
                     $ref = $code->_ref_tarmed;
                     $montant = $item->quantite * $ref->tp_al * $ref->f_al * $this->_coeff;
                 }
                 $this->_montant_retrocession += $montant;
                 $this->_retrocessions[$item->code] = array($item->_montant_facture, $montant);
             }
         }
     }
     if ($this->_montant_retrocession && $this->annule) {
         $this->_retrocessions["extourne"] = array(0, -$this->_montant_retrocession);
         $this->_montant_retrocession = 0.0;
     }
     return $this->_montant_retrocession;
 }
<?php

/**
 * $Id: vw_retrocession_regles.php 19043 2013-05-07 10:17:32Z aurelie17 $
 *
 * @package    Mediboard
 * @subpackage dPfacturation
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version    $Revision: 19043 $
 */
CCanDo::checkEdit();
$prat_id = CValue::getOrSession("prat_id", "0");
$mediuser = new CMediusers();
$listPrat = $mediuser->loadPraticiens();
// Chargement du praticien
$praticien = new CMediusers();
$praticien->load($prat_id);
$praticien->loadRefsRetrocessions();
// Creation du template
$smarty = new CSmartyDP();
$smarty->assign("listPrat", $listPrat);
$smarty->assign("praticien", $praticien);
$smarty->display("vw_retrocession_regles.tpl");