public function TotalCost()
 {
     $totalCost = new Cost(0, 0, 0, 0);
     foreach ($this->Members() as $resource) {
         $totalCost->AddCost($resource->Cost());
     }
     return $totalCost;
 }
Example #2
0
 public function CostIsDeductible(Cost $value)
 {
     $enoughMetal = $this->Metal() - $value->Metal() >= 0;
     $enoughCrystal = $this->Crystal() - $value->Crystal() >= 0;
     $enoughDeuterium = $this->Deuterium() - $value->Deuterium() >= 0;
     $enoughEnergy = $this->Energy() - $value->Energy() >= 0;
     if ($enoughMetal && $enoughCrystal && $enoughDeuterium && $enoughEnergy) {
         return true;
     }
     return false;
 }
Example #3
0
 public function BuildTime(Colony $colony, Cost $buildCosts)
 {
     // Calculate time required
     global $NN_config;
     $metalCost =& $buildCosts->Metal();
     $crystalCost =& $buildCosts->Crystal();
     $gameSpeed =& $NN_config["game_speed"];
     $robotFactories = $colony->Buildings()->GetMemberByName("robotics_factory")->Amount();
     $nanoFactories = $colony->Buildings()->GetMemberByName("nano_factory")->Amount();
     $manufacturers = $colony->Owner()->Officers()->GetMemberByName("manufacturer")->Amount();
     $timeRequired = ($metalCost + $crystalCost) / $gameSpeed * (1 / ($robotFactories + 1)) * pow(0.5, $nanoFactories);
     $timeRequired = floor($timeRequired * 3600 * (1 - $manufacturers * 0.1));
     return $timeRequired;
 }
 public function run()
 {
     //se ingresa el libro de darwin
     //DB::statement("INSERT INTO lor_lecture (title, author, year, publisher, content, created_at, updated_at, deleted_at) VALUES ('El origen de las especies', 'Charles Darwin', '1859', 'Dominio publico', 'temas vivos.', NOW(),NOW(), NULL);");
     $user = User::create(array('profile' => 'super_admin', 'firstname' => 'Alexander Andres Londono Espejo', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => Hash::make('admin')));
     $user->roles()->attach(1);
     $user->roles()->attach(2);
     $user->roles()->attach(3);
     $user->roles()->attach(4);
     $user->roles()->attach(5);
     $user->roles()->attach(6);
     $user->roles()->attach(7);
     $user->roles()->attach(8);
     $user->roles()->attach(9);
     $user->roles()->attach(10);
     $user->roles()->attach(11);
     $user->roles()->attach(12);
     $user->roles()->attach(13);
     $user->roles()->attach(14);
     $user->roles()->attach(15);
     $user->roles()->attach(16);
     $user->roles()->attach(17);
     $user->roles()->attach(18);
     $user->roles()->attach(19);
     $user->roles()->attach(20);
     $user->roles()->attach(21);
     $user->roles()->attach(22);
     $user->roles()->attach(23);
     $user->roles()->attach(24);
     $user->roles()->attach(25);
     $user->roles()->attach(26);
     $user->roles()->attach(27);
     $user->roles()->attach(28);
     $user->roles()->attach(29);
     $user->roles()->attach(30);
     $user->roles()->attach(31);
     $user->roles()->attach(32);
     $faker = Faker\Factory::create();
     $count_client = 50;
     foreach (range(1, $count_client) as $index) {
         $user = User::create(['firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'username' => 'admin' . $index, 'email' => $faker->email, 'identification' => $faker->numberBetween(19999999, 99999999), 'password' => Hash::make('admin' . $index)]);
         //Ingreso datos de prueba de clientes
         $client = Client::create(['name' => $faker->company, 'address' => 'Caucasia Antioquia', 'enable' => 'SI']);
         //Ingreso datos de prueba de proveedores
         $provider = Provider::create(['name' => $faker->company, 'email' => $faker->email, 'telephone' => $faker->numberBetween(19999999, 99999999), 'country' => 'Colombia', 'department' => 'Antioquia', 'city' => 'Medellin', 'enable' => 'SI']);
         //Ingreso datos de prueba de costos
         $costs = Cost::create(['name' => $faker->company, 'type' => 'Otro', 'value' => $faker->numberBetween(1999, 99999), 'description' => $faker->company, 'resposible' => 'Alexander', 'enable' => 'SI']);
         //Ingreso datos de prueba de categoria
         $category = Category::create(['name' => $faker->company, 'description' => '', 'enable' => 'SI']);
         //Ingreso datos de prueba de productos
         $product = Product::create(['name' => $faker->company, 'description' => '', 'cost' => $faker->numberBetween(1999, 9999), 'value' => $faker->numberBetween(19999, 99999), 'enable' => 'SI']);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     //se limpian las tablas intermedias
     DB::table('users_roles')->delete();
     //se limpian las tablas de los modelos
     User::truncate();
     Roles::truncate();
     Client::truncate();
     Provider::truncate();
     Cost::truncate();
     Category::truncate();
     Product::truncate();
     //Shopping::truncate();
     // se insertan los roles del sistema
     $this->call('RolesTableSeeder');
     // se ponen datos de pruebas
     $this->call('DevelopmentTableSeeder');
 }
Example #6
0
	public static function Create($data)
	{
		$in = array();
		$cost = Cost::CostFromString($data["Mana Cost"]);
		$in["cost"] = $cost->ID();
		$in["rarity"] = strtoupper($data["Rarity"]);
		$map = array(
			"name" => "Card Name",
			"power" => "P",
			"toughness" => "T",
			"text" => "Card Text",
			"flavor" => "Flavor Text",
			"loyalty" => "Loyalty",
			"artist" => "Artist",
			"multiverse" => "multiverse",
			"number" => "Card #",
			"set" => "set"
		);
		foreach( $map as $key => $val )
		{
			if ( isset( $data[$val] ) )
				$in[$key] = $data[$val];
		}
		DB::zdb()->insert(Card::$TABLE, $in);
		$id = DB::zdb()->lastInsertId();
		foreach( $data["Types"] as $type )
		{
			DB::zdb()->insert(Card::$TYPES,
				array("card" => $id, "type" => $type)
			);
		}
		foreach( $data["Subtypes"] as $type )
		{
			DB::zdb()->insert(Card::$SUBS,
				array("card" => $id, "subtype" => $type)
			);
		}
		Image::Import($data["multiverse"], $id);
	}
 /**
  * Возвращает модель по указанному идентификатору
  * Если модель не будет найдена - возникнет HTTP-исключение.
  *
  * @param integer идентификатор нужной модели
  *
  * @return void
  */
 public function loadModel($id)
 {
     $model = Cost::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('BalanceModule.balance', 'Запрошенная страница не найдена.'));
     }
     return $model;
 }
Example #8
0
                    <span class="cost-term cost-cash">
                        <?php 
        echo Yii::t('MarketModule.default', 'В');
        ?>
 
                        <?php 
        if ($cost->rent_term == '1') {
            ?>
                            <?php 
            echo Yii::t('MarketModule.default', 'неделю');
            ?>
                        <?php 
        } else {
            ?>
                            <?php 
            echo Cost::enumTerm($cost->rent_term);
            ?>
                        <?php 
        }
        ?>
 
                    </span>                    
                <?php 
    }
    ?>
 
                <span class="cost-cash"><?php 
    echo isset($cost['nds_include']) && isset($cost['cash']) && $cost['nds_include'] == '0' && $cost['cash'] == '0' ? Yii::t('MarketModule.default', 'с НДС') : '';
    ?>
</span>
                <span class="cost-cash"><?php 
 public function TotalCost()
 {
     $totalCost = new Cost();
     foreach ($this->Members() as $unit) {
         $totalCost->AddCost($unit->BuildCost());
     }
     return $totalCost;
 }
 public function setCost(CostForm $CostForm)
 {
     if (!empty($this->special_technique_id)) {
         $special_technique_id = $this->special_technique_id;
         Yii::app()->db->createCommand("DELETE FROM {{special_technique_cost}} WHERE special_technique_id=:special_technique_id")->bindParam(':special_technique_id', $special_technique_id)->execute();
     }
     for ($i = 1; $i <= CostForm::count; ++$i) {
         if ($CostForm->{"value_{$i}"} == '') {
             break;
         }
         $Cost = new Cost();
         $Cost->value = $CostForm->{"value_{$i}"};
         $Cost->currency_id = $CostForm->{"currency_id_{$i}"};
         $Cost->type_id = $CostForm->{"type_id_{$i}"};
         $Cost->cash = $CostForm->{"cash_{$i}"};
         $Cost->nds_include = $CostForm->{"nds_include_{$i}"};
         $Cost->rent_term = $CostForm->{"rent_term_{$i}"};
         $Cost->save();
         $special_technique_id = $this->special_technique_id;
         $cost_id = $Cost->cost_id;
         Yii::app()->db->createCommand("INSERT INTO {{special_technique_cost}}(special_technique_id, cost_id, `order`) VALUES(:special_technique_id, :cost_id, :order)")->bindParam(':special_technique_id', $special_technique_id)->bindParam(':cost_id', $cost_id)->bindParam(':order', $i)->execute();
     }
 }
Example #11
0
 public static function fromPostData($data)
 {
     CL_Loader::get_instance()->library('PostDataFormatException');
     $poi = new POI();
     $poi->id = (int) $data['id'];
     $poi->name = (string) $data['name'];
     $poi->label = (string) $data['label'];
     $poi->url = (string) $data['url'];
     $poi->lat = (double) $data['lat'];
     $poi->lng = (double) $data['lng'];
     // Description
     if (key_exists("description", $data)) {
         $poi->description = (string) $data['description'];
     }
     // Approach
     if (isset($data['approach'])) {
         if (!isset($data['approach']['text']) || !isset($data['approach']['drying']['value']) || !isset($data['approach']['drying']['details'])) {
             throw new PostDataFormatException("Approach");
         }
         $poi->approach['text'] = (string) $data['approach']['text'];
         $poi->approach['drying']['value'] = (string) $data['approach']['drying']['value'];
         $poi->approach['drying']['details'] = (string) $data['approach']['drying']['details'];
     }
     // Contact
     if (isset($data['contact']['type']) && isset($data['contact']['value'])) {
         // Make sure all attributes have the same length
         if (count($data['contact']['type']) === count($data['contact']['value'])) {
             for ($i = 0; $i < count($data['contact']['type']); $i++) {
                 $poi->contact[] = ['type' => (string) $data['contact']['type'][$i], 'value' => (string) $data['contact']['value'][$i]];
             }
         }
     }
     // Anchoring
     if (key_exists("anchoring", $data)) {
         // Depth
         $poi->anchoring['depth']['from'] = (double) $data['anchoring']['depth']['from'];
         $poi->anchoring['depth']['to'] = (double) $data['anchoring']['depth']['to'];
         // Holding
         $poi->anchoring['holding']['values'] = [];
         foreach ((array) @$data['anchoring']['holding']['values'] as $value) {
             $poi->anchoring['holding']['values'][] = $value;
         }
         $poi->anchoring['holding']['details'] = (string) $data['anchoring']['holding']['details'];
         // Price
         $poi->anchoring['cost'] = Cost::fromPostData($data['anchoring']['cost']);
         // Soujourn
         $poi->anchoring['tax'] = Tax::fromPostData($data['anchoring']['tax']);
     }
     // Charts
     if (key_exists("charts", $data)) {
         foreach ($data['charts'] as $chart) {
             if ($chart !== "") {
                 $poi->charts[] = (string) $chart;
             }
         }
     }
     // Sources
     if (key_exists("sources", $data)) {
         foreach ($data['sources'] as $source) {
             if ($source !== "") {
                 $poi->sources[] = (string) $source;
             }
         }
     }
     // Exposure
     if (key_exists("exposure", $data)) {
         // Wind
         $poi->exposure['wind']['value'] = (string) $data['exposure']['wind']['value'];
         foreach ((array) @$data['exposure']['wind']['dir'] as $wind) {
             if ($wind !== "") {
                 $poi->exposure['wind']['dir'][] = (string) $wind;
             }
         }
         // Swell
         $poi->exposure['swell']['value'] = (string) $data['exposure']['swell']['value'];
         foreach ((array) @$data['exposure']['swell']['dir'] as $swell) {
             if ($swell !== "") {
                 $poi->exposure['swell']['dir'][] = (string) $swell;
             }
         }
     }
     // Attractions
     if (key_exists("attractions", $data)) {
         $poi->attractions = (string) $data['attractions'];
     }
     // Nightlife
     if (key_exists("nightlife", $data)) {
         $poi->nightlife = (string) $data['nightlife'];
     }
     return $poi;
 }
Example #12
0
	public static function CostFromString($str)
	{
		$match = array();
		$cond = "(1=1) ";
		static $colorMixer = array(
			"RR" => "red",			"PR" => "red",
			"GG" => "green",		"PG" => "green",
			"UU" => "blue",			"PU" => "blue",
			"WW" => "white",		"PW" => "white",
			"BB" => "black", 		"PB" => "black",
			"RG" => "hybrid",		"RU" => "hybrid",
			"RW" => "hybrid",		"RB" => "hybrid",
			"GU" => "hybrid",		"GW" => "hybrid",
			"GB" => "hybrid",		"UW" => "hybrid",
			"UB" => "hybrid",		
			"BW" => "hybrid",  		"2R" => "red",
			"2G" => "green",		"2B" => "black",
			"2U" => "blue",			"2W" => "white"
		);
		$uniqSymbols = array();
		
		if ( $str == "NONE" || strlen($str) < 2 )
		{
			$match["no_cost"] = 1;
		}
		else
		{
			$match["colorless"] = $str{0} . $str{1};
			$cond .= " AND colorless = " . $match["colorless"];
			$match["cmc"] = $match["colorless"];
			for ( $i = 2; $i < strlen($str); $i += 2 )
			{
				$buf = $str{$i} . $str{$i+1};
				if ( array_key_exists( $buf, $colorMixer )
					&& !in_array($buf, $uniqSymbols) )
				{
					$uniqSymbols[] = $buf;
				}
				if ( $buf <> "XX" )
					++$match["cmc"];
				else if ( $buf{0} == '2' )
					$match["cmc"] += 2;
				if ( array_key_exists( $buf, $match ) )
				{
					++$match[$buf];
				}
				else
				{
					$match[$buf] = 1;
				}
			}
			$match["color"] = "colorless";
			foreach ( $uniqSymbols as $symb )
			{
				if ( $match["color"] == "colorless"
					|| $match["color"] == $colorMixer[$symb] )
				{
					$match["color"] = $colorMixer[$symb];
				}
				else
				{
					$match["color"] = "gold";
				}
			}
			if ( $match["color"] == "hybrid" && count($uniqSymbols) > 1 )
				$match["color"] = "gold";
			$s = DB::zdb()->select()
				->from(Card::$COLORS, array("id"))
				->where("color = ?", $match["color"]);
			$match["color"] = DB::zdb()->fetchOne($s);
		}
		if ( !isset( $match["no_cost"] ) )
		{
			$cond .= " AND no_cost IS NULL ";
		}
		foreach ( Cost::$FIELDS as $key => $val )
		{
			if ( !isset( $match[$key] ) )
			{
				$cond .= " AND $val IS NULL ";
			}
			else
			{
				$cond .= ( " AND $val = " . $match[$key] . " ");
				$match[$val] = $match[$key];
				unset($match[$key]);
			}
		}
		
		// Search the DB for it
		$s = DB::zdb()->select()
			->from(Cost::$TABLE, array("id"))
			->where( $cond );
		$id = DB::zdb()->fetchOne($s);
		
		if ( $id )
		{
			return new Cost($id);
		}
		else
		{
			DB::zdb()->insert(Cost::$TABLE, $match);
			return Cost::CostFromString($str);
		}
	}
Example #13
0
?>
                        </section>
                        <section class="col-sm-3 lease-terms" style="display: none;">
                            <?php 
echo $form->dropDownListGroup($SpecialTechniqueForm, 'cost_rent_term', ['widgetOptions' => ['data' => Cost::enumTerm()]]);
?>
                        </section>
                        <section class="col-sm-4">
                            <?php 
echo $form->dropDownListGroup($SpecialTechniqueForm, 'cost_nds_include', ['widgetOptions' => ['data' => Cost::enumNds()]]);
?>
                        
                        </section>
                        <section class="col-sm-4">
                            <?php 
echo $form->dropDownListGroup($SpecialTechniqueForm, 'cost_cash', ['widgetOptions' => ['data' => Cost::enumCash()]]);
?>
                        </section>
                        <script>
                            $(function() {
                                $("#SpecialTechniqueForm_cost_cash").change(function() {
                                    value = $(this).find('option:selected').val();
                                    if(value=='1') {
                                        $("#SpecialTechniqueForm_cost_nds_include").attr('disabled', true);
                                        $("#SpecialTechniqueForm_cost_nds_include").parents('div.checkbox').hide();
                                    } else {
                                        $("#SpecialTechniqueForm_cost_nds_include").attr('disabled', false);
                                        $("#SpecialTechniqueForm_cost_nds_include").parents('div.checkbox').show();
                                    }
                                });
                            });
Example #14
0
 *   @license  https://github.com/yupe/yupe/blob/master/LICENSE BSD
 *   @link     http://yupe.ru
 **/
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', ['action' => Yii::app()->createUrl($this->route), 'method' => 'get', 'type' => 'vertical', 'htmlOptions' => ['class' => 'well']]);
?>

<fieldset>
    <div class="row">
        <div class="col-sm-3">
            <?php 
echo $form->textFieldGroup($model, 'id', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('id'), 'data-content' => $model->getAttributeDescription('id')]]]);
?>
        </div>
		<div class="col-sm-3">
            <?php 
echo $form->dropDownListGroup($model, 'cost_id', ['widgetOptions' => ['data' => CHtml::listData(Cost::model()->findAll(), 'id', 'name')]]);
?>
        </div>
		<div class="col-sm-3">
            <?php 
echo $form->textFieldGroup($model, 'receiver', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('receiver'), 'data-content' => $model->getAttributeDescription('receiver')]]]);
?>
        </div>
		<div class="col-sm-3">
            <?php 
echo $form->textFieldGroup($model, 'date', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('date'), 'data-content' => $model->getAttributeDescription('date')]]]);
?>
        </div>
		<div class="col-sm-3">
            <?php 
echo $form->textFieldGroup($model, 'price', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('price'), 'data-content' => $model->getAttributeDescription('price')]]]);
Example #15
0
 /**
  * Get all of the tasks for a given user.
  *
  * @param  User  $user
  * @return Collection
  */
 public function allCostStatuses()
 {
     return Cost::orderBy('id', 'asc')->get();
 }
 public function actionPrint($inflow, $outflow, $totalArr, $in, $out)
 {
     $costArr = Cost::model()->findAll();
     $codeArr = Subject::model()->findAll();
     //////////////////////////////////////////////////////////////////////
     //Формирование файла exel
     $phpExcelPath = Yii::getPathOfAlias('application.components.phpexel');
     include $phpExcelPath . DIRECTORY_SEPARATOR . 'PHPExcel.php';
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator("Спасибоку")->setLastModifiedBy("system")->setTitle("Балансовая ведомость")->setSubject("Спасибоку")->setDescription("Балансовая ведомость, отражающая приход и расход")->setKeywords("Приход,Расход,Итог")->setCategory("Отчет");
     //Создание вкладок
     $sheet1 = $objPHPExcel->createSheet(0);
     $sheet2 = $objPHPExcel->createSheet(1);
     $sheet3 = $objPHPExcel->createSheet(2);
     $sheet1->setTitle("Приход");
     $sheet2->setTitle("Расход");
     $sheet3->setTitle("Итог");
     //Создание заголовков
     $sheet1->setCellValue("A1", "Дата")->setCellValue("B1", "Шифр")->setCellValue("C1", "Основание")->setCellValue("D1", "Исполнитель")->setCellValue("E1", "Оплата")->setCellValue("F1", "Другая информация")->setCellValue("H1", "Наименование услуги")->setCellValue("I1", "Шифр");
     $sheet2->setCellValue("A1", "Дата")->setCellValue("B1", "Шифр")->setCellValue("C1", "Получатель")->setCellValue("D1", "Сумма")->setCellValue("E1", "Основание")->setCellValue("F1", "Комментарий")->setCellValue("H1", "Наименование")->setCellValue("I1", "Шифр");
     $sheet3->setCellValue("A1", "Дата")->setCellValue("B1", "Приход")->setCellValue("C1", "Расход");
     $sheet1->getStyle('A1:F1')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'dbd8e9'))));
     $sheet1->getStyle('H1:I1')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'dbd8e9'))));
     $sheet2->getStyle('A1:F1')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'dbd8e9'))));
     $sheet2->getStyle('H1:I1')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'dbd8e9'))));
     $sheet3->getStyle('A1:C1')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'dbd8e9'))));
     //Inflow
     $i = 2;
     foreach ($codeArr as $value) {
         if ($i % 2 != 0) {
             $sheet1->getStyle('H' . $i . ':I' . $i)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'B8CCE4'))));
         }
         $sheet1->setCellValue("H" . $i, $value->name)->setCellValue("I" . $i, $value->code);
         $i++;
     }
     $i = 2;
     foreach ($inflow as $value) {
         if ($i % 2 != 0) {
             $sheet1->getStyle('A' . $i . ':F' . $i)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'B8CCE4'))));
         }
         $sheet1->setCellValue("A" . $i, $value->date)->setCellValue("B" . $i, $value->subject->code)->setCellValue("C" . $i, $value->based)->setCellValue("D" . $i, $value->receiver)->setCellValue("E" . $i, $value->form->price)->setCellValue("F" . $i, $value->comment);
         $i++;
     }
     $sheet1->setCellValue('A' . $i, "Итог:");
     $sheet1->setCellValue('B' . $i, $in);
     //Outflow
     $i = 2;
     foreach ($costArr as $value) {
         if ($i % 2 != 0) {
             $sheet2->getStyle('H' . $i . ':I' . $i)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'B8CCE4'))));
         }
         $sheet2->setCellValue("H" . $i, $value->name)->setCellValue("I" . $i, $value->code);
         $i++;
     }
     $i = 2;
     foreach ($outflow as $value) {
         if ($i % 2 != 0) {
             $sheet2->getStyle('A' . $i . ':F' . $i)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'B8CCE4'))));
         }
         $sheet2->setCellValue("A" . $i, $value->date)->setCellValue("B" . $i, $value->cost->name)->setCellValue("C" . $i, $value->receiver)->setCellValue("D" . $i, $value->price)->setCellValue("E" . $i, $value->based)->setCellValue("F" . $i, $value->note);
         $i++;
     }
     $sheet2->setCellValue('A' . $i, "Итог:");
     $sheet2->setCellValue('B' . $i, $out);
     //Total
     $i = 2;
     foreach ($totalArr as $value) {
         if ($i % 2 != 0) {
             $sheet3->getStyle('A' . $i . ':C' . $i)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'B8CCE4'))));
         }
         $sheet3->setCellValue("A" . $i, $value['date'])->setCellValue("B" . $i, $value['inflow'])->setCellValue("C" . $i, $value['outflow']);
         $i++;
     }
     $x = array_pop($totalArr);
     $sheet3->setCellValue("A" . $i, "Итог");
     $sheet3->setCellValue("C" . $i, $x['total']);
     //////////////////////////////////////////////////////////////
     // Автоматическое скачивание файла
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="Отчет.xlsx"');
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
     ////////////////////
 }
 /**
  * Metodo para hacer la busqueda de un cliente
  */
 public static function search()
 {
     $items = array();
     $search = '';
     if (Input::get('search')) {
         $search = Input::get('search');
         $arrparam = explode(' ', $search);
         $items = Cost::whereNested(function ($q) use($arrparam) {
             $p = $arrparam[0];
             $q->whereNested(function ($q) use($p) {
                 $q->where('name', 'LIKE', '%' . $p . '%');
                 $q->orwhere('type', 'LIKE', '%' . $p . '%');
                 $q->orwhere('description', 'LIKE', '%' . $p . '%');
                 $q->orwhere('date_cost', 'LIKE', '%' . $p . '%');
                 $q->orwhere('resposible', 'LIKE', '%' . $p . '%');
                 $q->orwhere('value', 'LIKE', '%' . $p . '%');
                 $q->orwhere('value', 'LIKE', '%' . $p . '%');
             });
             $c = count($arrparam);
             if ($c > 1) {
                 //para no repetir el primer elemento
                 //foreach ($arrparam as $p) {
                 for ($i = 1; $i < $c; $i++) {
                     $p = $arrparam[$i];
                     $q->whereNested(function ($q) use($p) {
                         $q->where('name', 'LIKE', '%' . $p . '%');
                         $q->orwhere('type', 'LIKE', '%' . $p . '%');
                         $q->orwhere('description', 'LIKE', '%' . $p . '%');
                         $q->orwhere('date_cost', 'LIKE', '%' . $p . '%');
                         $q->orwhere('resposible', 'LIKE', '%' . $p . '%');
                         $q->orwhere('value', 'LIKE', '%' . $p . '%');
                         $q->orwhere('value', 'LIKE', '%' . $p . '%');
                     }, 'OR');
                 }
             }
         })->whereNull('deleted_at')->orderBy('name', 'ASC')->paginate(10);
         return View::make('cost.view_cost', compact('items', 'search'));
     }
 }
 /**
  * Create an associative array of object properties from XML
  * @static
  * @param SimpleXMLElement $parsedResponse - XML of registrant
  * @return
  */
 public static function createStruct($parsedResponse)
 {
     $reg['title'] = (string) $parsedResponse->title;
     $reg['updated'] = (string) $parsedResponse->updated;
     $reg['link'] = (string) $parsedResponse->link->Attributes()->href;
     $reg['id'] = (string) $parsedResponse->id;
     $content = $parsedResponse->content->children();
     $reg['lastName'] = (string) $content->Registrant->LastName;
     $reg['firstName'] = (string) $content->Registrant->FirstName;
     $reg['email'] = (string) $content->Registrant->EmailAddress;
     $reg['registrationStatus'] = (string) $content->Registrant->RegistrationStatus;
     $reg['registrationDate'] = (string) $content->Registrant->RegistrationDate;
     $reg['guestCount'] = (string) $content->Registrant->GuestCount;
     $reg['paymentStatus'] = (string) $content->Registrant->PaymentStatus;
     $reg['personalInformation'] = new PersonalInformation(PersonalInformation::createStruct($content->Registrant->PersonalInformation));
     $reg['businessInformation'] = new BusinessInformation(BusinessInformation::createStruct($content->Registrant->BusinessInformation));
     $reg['customInformation1'] = array();
     $reg['customInformation2'] = array();
     $reg['costs'] = array();
     if (isset($content->Registrant->CustomInformation1->CustomField)) {
         foreach ($content->Registrant->CustomInformation1->CustomField as $customInfo) {
             $reg['customInformation1'][] = CustomField::createFromXml($customInfo);
         }
     }
     if (isset($content->Registrant->CustomInformation2->CustomField)) {
         foreach ($content->Registrant->CustomInformation2->CustomField as $customInfo) {
             $reg['customInformation2'][] = CustomField::createFromXml($customInfo);
         }
     }
     if (isset($content->Registrant->Costs->Cost)) {
         foreach ($content->Registrant->Costs->Cost as $cost) {
             $reg['costs'] = new Cost(Cost::createStruct($cost));
         }
     }
     return $reg;
 }
Example #19
0
    echo $i > 1 ? 'none' : 'block';
    ?>
">
                            <section class="col-sm-5">
                                <?php 
    echo $form->textFieldGroup($CostForm, 'value_' . $i);
    ?>
                            </section>
                            <section class="col-sm-3 cost-select">
                                <?php 
    echo $form->dropDownListGroup($CostForm, 'currency_id_' . $i, ['widgetOptions' => ['data' => Cargo::getCurrency()]]);
    ?>
                            </section>
                            <section class="col-sm-3 lease-terms">
                                <?php 
    echo $form->dropDownListGroup($CostForm, 'rent_term_' . $i, ['widgetOptions' => ['data' => Cost::enumTerm()]]);
    ?>
                            </section>
                            <section class="col-sm-3">
                                <?php 
    echo $form->dropDownListGroup($CostForm, 'nds_include_' . $i, ['widgetOptions' => ['data' => Cargo::enumNds()]]);
    ?>
                        
                            </section>
                            <section class="col-sm-2">
                                <?php 
    echo $form->dropDownListGroup($CostForm, 'cash_' . $i, ['widgetOptions' => ['data' => Cargo::enumCash()]]);
    ?>
                            </section>
                            <div class="row-buttons">
                                <?php 
Example #20
0
<?php

if ( isset( $_GET["cost"] ) )
{
	$in = $_GET["cost"];
	$cost = Cost::CostFromString($_GET["cost"]);
	$in = substr($in, 2);
}
else
{
	$cost = new Cost($_GET["id"]);
	$in = $cost->EditString();
}

$d = $cost->EditRecord();
$cL = $d->Get("colorless");
$clp1 = $cL+1;
$cL = str_pad($cL, 2, "0", STR_PAD_LEFT);
$clp1 = str_pad($clp1, 2, "0", STR_PAD_LEFT);

$s = DB::zdb()->select()
	->from("symbols");
	
$rows = DB::zdb()->fetchAll($s);
$colors = array();

function BasicImgStr($color, $i)
{
	$r  = "<span onmouseover=\"hover($i);\"";
	$r .= " onclick=\"click_base($i);\">";
	$r .= '<img src="Views/img/mana_symbols/';
Example #21
0
require_once "classes\\class_resourceparser.php";
// $time1 = microtime();
// $dapsap = array();
// for( $i = 0; $i < 1000; $i++)
// {
// $kbytes = memory_get_usage() / 1024;
// echo "current memory usage: $kbytes KB<br/>";
// $dapsap[$i] = new ResourceParser();
// }
// $time2 = microtime();
// $result = $time2 - $time1;
// echo "time used: ".$result."<br/>";
// $peak = memory_get_peak_usage() / 1024;
// echo "peak memory usage: ".$peak." KB";
Helper::var_dump_pre(ResourceParser::Instance()->ProductionUnits());
Helper::var_dump_pre(ResourceParser::Instance()->BuildingUnits());
Helper::var_dump_pre(ResourceParser::Instance()->Technologies());
Helper::var_dump_pre(ResourceParser::Instance()->DefenseUnits());
Helper::var_dump_pre(ResourceParser::Instance()->ShipUnits());
Helper::var_dump_pre(ResourceParser::Instance()->MissileUnits());
Helper::var_dump_pre(ResourceParser::Instance()->Officers());
$cost = new Cost(100, 100, 100, 100);
$cost1 = new Cost(50, 50, 50, 50);
$res = new Resource("Test", $cost, NULL, NULL);
$cost->AddCost($res);
$cost1->AddCost($cost);
Helper::var_dump_pre($cost);
Helper::var_dump_pre($cost1);
?>