Example #1
0
 /**
  * add some more values (container id)
  *
  * @return array
  */
 protected function _addData($recordData)
 {
     $result = array();
     $aC = Billing_Controller_ArticleGroup::getInstance();
     $aGroup = $aC->getByName('Urkunden');
     $pC = Billing_Controller_PriceGroup::getInstance();
     $pGDiver = $pC->getByName('Taucher');
     $pGMember = $pC->getByName('Mitglied');
     $pGMTI = $pC->getByName('MTI');
     $pGMTA = $pC->getByName('MTA');
     $mwst = floor(($recordData['VK1'] / $recordData['VK1EXKL'] - 1) * 100);
     if ($mwst > 8) {
         $mwst = 19;
     } elseif ($mwst < 7) {
         $mwst = 0;
     }
     $vatId = Billing_Controller_Vat::getInstance()->getByName($mwst);
     $articleUnit = Billing_Controller_ArticleUnit::getInstance()->getByName('Stück');
     if ($mwst == 19) {
         $recordData['VK1EXKL'] = $recordData['VK1'] / 1.19;
         $recordData['VK2EXKL'] = $recordData['VK2'] / 1.19;
         $recordData['VK3EXKL'] = $recordData['VK3'] / 1.19;
     }
     $priceGroups['DIVER'] = array('id' => $pGDiver->getId(), 'netto' => $recordData['VK1EXKL'], 'brutto' => $recordData['VK1']);
     $priceGroups['MEMBER'] = array('id' => $pGMember->getId(), 'netto' => $recordData['VK2EXKL'], 'brutto' => $recordData['VK2']);
     $priceGroups['MTI'] = array('id' => $pGMTI->getId(), 'netto' => $recordData['VK3EXKL'], 'brutto' => $recordData['VK3']);
     $priceGroups['MTA'] = array('id' => $pGMTA->getId(), 'netto' => $recordData['VK3EXKL'], 'brutto' => $recordData['VK3']);
     $result['article_group_id'] = $aGroup->getId();
     $result['prices'] = $priceGroups;
     $result['vat_id'] = $vatId;
     $result['article_unit_id'] = $articleUnit->getId();
     return $result;
 }
Example #2
0
 /**
  * the singleton pattern
  *
  * @return SoEventManager_Controller_SoEvent
  */
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #3
0
 /**
  * add some more values (container id)
  *
  * @return array
  */
 protected function _addData($recordData)
 {
     $result = array();
     $priceGroupId = 1;
     $articleGroupId = null;
     if ($recordData['article_ext_nr']) {
         $isbn = $recordData['article_ext_nr'];
         if (strpos($isbn, 'WS')) {
             $articleGroupId = 5;
         } elseif (strpos($isbn, 'WK')) {
             $articleGroupId = 4;
         } elseif (strpos($isbn, 'OG')) {
             $articleGroupId = 3;
         } elseif (strpos($isbn, 'FB')) {
             $articleGroupId = 2;
         } elseif (strpos($isbn, 'EB')) {
             $articleGroupId = 1;
         }
     }
     if (!$articleGroupId) {
         $articleGroupId = 1;
     }
     $result['article_group_id'] = $articleGroupId;
     $pC = Billing_Controller_PriceGroup::getInstance();
     $pGEmpf = $pC->getByName('Empfohlen');
     $pGMitgl = $pC->getByName('Mitglied');
     $pGEntn = $pC->getByName('Entnahme');
     $vatId = Billing_Controller_Vat::getInstance()->getByName(7);
     $articleUnit = Billing_Controller_ArticleUnit::getInstance()->getByName('Stück');
     $recordData['mitgl_preis'] = str_replace(',', '.', $recordData['mitgl_preis']);
     $recordData['entn_preis'] = str_replace(',', '.', $recordData['entn_preis']);
     $recordData['empf_preis'] = str_replace(',', '.', $recordData['empf_preis']);
     if (!is_numeric($recordData['mitgl_preis'])) {
         $recordData['mitgl_preis'] = 0;
     } else {
         $recordData['mitgl_preis'] = abs((double) $recordData['mitgl_preis']);
     }
     if (!is_numeric($recordData['entn_preis'])) {
         $recordData['entn_preis'] = 0;
     } else {
         $recordData['entn_preis'] = abs((double) $recordData['entn_preis']);
     }
     if (!is_numeric($recordData['empf_preis'])) {
         $recordData['empf_preis'] = 0;
     } else {
         $recordData['empf_preis'] = abs((double) $recordData['empf_preis']);
     }
     $priceGroups['MITGL'] = array('id' => $pGMitgl->getId(), 'netto' => $recordData['mitgl_preis'], 'brutto' => $recordData['mitgl_preis'] * 1.07);
     $priceGroups['ENTN'] = array('id' => $pGEntn->getId(), 'netto' => $recordData['entn_preis'], 'brutto' => $recordData['entn_preis'] * 1.07);
     $priceGroups['EMPF'] = array('id' => $pGEmpf->getId(), 'netto' => $recordData['empf_preis'], 'brutto' => $recordData['empf_preis'] * 1.07);
     $result['prices'] = $priceGroups;
     $result['vat_id'] = $vatId;
     $result['article_unit_id'] = $articleUnit->getId();
     return $result;
 }
Example #4
0
 public function savePriceGroup($recordData)
 {
     return $this->_save($recordData, Billing_Controller_PriceGroup::getInstance(), 'PriceGroup');
 }