コード例 #1
0
ファイル: ArticleCsv.php プロジェクト: carriercomm/Billing-5
 /**
  * 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;
 }
コード例 #2
0
 /**
  * the singleton pattern
  *
  * @return SoEventManager_Controller_SoEvent
  */
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #3
0
ファイル: Json.php プロジェクト: carriercomm/Billing-5
 /**
  * Returns registry data of addressbook.
  * @see Tinebase_Application_Json_Abstract
  * 
  * @return mixed array 'variable name' => 'data'
  */
 public function getRegistryData()
 {
     $filter = new Tinebase_Model_ImportExportDefinitionFilter(array(array('field' => 'plugin', 'operator' => 'equals', 'value' => 'Billing_Import_BankCsv')));
     $importDefinitions = Tinebase_ImportExportDefinition::getInstance()->search($filter);
     //print_r($importDefinitions);
     try {
         $defaultDefinitionArray = Tinebase_ImportExportDefinition::getInstance()->getByName('bank_import_csv')->toArray();
     } catch (Tinebase_Exception_NotFound $tenf) {
         if (count($importDefinitions) > 0) {
             $defaultDefinitionArray = $importDefinitions->getFirstRecord()->toArray();
         } else {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' No import definitions found for Banks');
             $defaultDefinitionArray = array();
         }
     }
     $registryData = array('Order' => Billing_Controller_Order::getInstance()->getRegistryData(), 'StockLocation' => Billing_Controller_StockLocation::getInstance()->getRegistryData(), 'PaymentMethods' => $this->getPaymentMethodsAsSimpleArray(), 'Context' => $this->getContextsAsSimpleArray(), 'ArticleGroups' => Billing_Controller_ArticleGroup::getInstance()->getArticleGroupsAsSimpleArray(), 'DebitorGroups' => Billing_Controller_DebitorGroup::getInstance()->getDebitorGroupsAsSimpleArray(), 'ArticleSeriess' => Billing_Controller_ArticleSeries::getInstance()->getArticleSeriessAsSimpleArray(), 'AccountSystems' => Billing_Controller_AccountSystem::getInstance()->getAccountSystemsAsSimpleArray(), 'AccountClasss' => Billing_Controller_AccountClass::getInstance()->getAccountClasssAsSimpleArray(), 'defaultBankImportDefinition' => $defaultDefinitionArray, 'importDefinitions' => array('results' => $importDefinitions->toArray(), 'totalcount' => count($importDefinitions)));
     return $registryData;
 }