Пример #1
0
 public function testStemAndLeafPlotPrint()
 {
     $print = true;
     Distribution::stemAndLeafPlot([1, 2, 3], $print);
     // OK if it made it here without error
     $this->assertTrue(true);
 }
 /**
  * @param string           $name
  * @param string           $overview
  * @param ICompany         $company
  * @param bool             $active
  * @param IMarketPlaceType $marketplace_type
  * @param null|string      $call_2_action_url
  * @return ICompanyService
  */
 public function buildCompanyService($name, $overview, ICompany $company, $active, IMarketPlaceType $marketplace_type, $call_2_action_url = null, $live_id = null, $published = null)
 {
     $distribution = new Distribution();
     $distribution->setName($name);
     $distribution->setOverview($overview);
     $distribution->setCompany($company);
     if ($active) {
         $distribution->activate();
     } else {
         $distribution->deactivate();
     }
     $distribution->setMarketplace($marketplace_type);
     $distribution->setCall2ActionUri($call_2_action_url);
     return $distribution;
 }
Пример #3
0
 public function actionSavePdf($id)
 {
     $distribution = Distribution::model()->findByPk($id);
     $html = $this->actionPrint($id);
     //echo $html;
     $mPDF1 = Yii::app()->ePdf->mpdf('ar', 'A4');
     $mPDF1->WriteHTML($html);
     $mPDF1->Output($distribution->name . '_vouchers.pdf', "D");
     Yii::app()->end();
 }
 public function deleteSite(&$markerSite)
 {
     $distribution = Distribution::find($markerSite->distribution);
     Authorization::where('atlas_id', '=', $markerSite->id)->delete();
     Log::info("Deleted authorization " . $markerSite->id . " from " . $_SERVER['REMOTE_ADDR']);
     Log::info("Deleting Site" . $markerSite->id . " from " . $_SERVER['REMOTE_ADDR']);
     $markerSite->delete();
     Log::info("Deleted Site");
     Log::info("Distribution name=" . $distribution->name . " id=" . $distribution->id . " standard=" . $distribution->is_standard);
     if ($distribution && $distribution->isNonStandard()) {
         Log::info("Deleting distribution " . $distribution->id . " from " . $_SERVER['REMOTE_ADDR']);
         $distribution->delete();
         Log::info("Deleted Distribution");
     }
 }
Пример #5
0
 public function getVendor($distribution_id)
 {
     $distribution = Distribution::model()->findByPk($distribution_id);
     if (!$distribution) {
         return 0;
     }
     $criteria = "(0";
     foreach ($distribution->subdistributions as $subdistribution) {
         foreach ($subdistribution->distributionVouchers as $distributionVoucher) {
             $criteria .= "," . $distributionVoucher->id;
         }
     }
     $criteria .= ")";
     $voucher = Voucher::model()->find("ben_id = " . $this->id . " and distribution_voucher_id in " . $criteria);
     if ($voucher->vendor_id == null) {
         return 0;
     }
     return $voucher->vendor_id;
 }
Пример #6
0
echo $form->textArea($model, 'slogan_en');
?>
		<?php 
echo $form->error($model, 'slogan_en');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'slogan_ar');
?>
		<?php 
echo $form->textArea($model, 'slogan_ar');
?>
		<?php 
echo $form->error($model, 'slogan_ar');
?>
		</div><!-- row -->

		<label><?php 
echo GxHtml::encode($model->getRelationLabel('distributions'));
?>
</label>
		<?php 
echo $form->checkBoxList($model, 'distributions', GxHtml::encodeEx(GxHtml::listDataEx(Distribution::model()->findAllAttributes(null, true)), false, true));
?>

<?php 
echo GxHtml::submitButton(Yii::t('app', 'Save'));
$this->endWidget();
?>
</div><!-- form -->
Пример #7
0
 /**
  * The Distribution type
  * @param   string    $distribution The optional distribution type
  * @return  string                  The distribution type
  * @author      Reto Kohli <*****@*****.**>
  */
 function distribution($distribution = null)
 {
     if (isset($distribution)) {
         $this->distribution = Distribution::isDistributionType($distribution) ? $distribution : Distribution::getDefault();
     }
     return $this->distribution;
 }
 public function getDistributionName($id)
 {
     $distribution = Distribution::find($id);
     return $distribution ? $distribution->name : null;
 }
Пример #9
0
<?php

$this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage'));
$this->menu = array(array('label' => Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' ' . $model->label(), 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('subdistribution-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo Yii::t('app', 'Manage') . ' ' . GxHtml::encode($model->label(2));
?>
</h1>

<p>
You may optionally enter a comparison operator (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; or =) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo GxHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button'));
?>
<div class="search-form">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'subdistribution-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'code', 'start_date', 'end_date', array('name' => 'region_id', 'value' => 'GxHtml::valueEx($data->region)', 'filter' => GxHtml::listDataEx(Community::model()->findAllAttributes(null, true))), array('name' => 'distribution_id', 'value' => 'GxHtml::valueEx($data->distribution)', 'filter' => GxHtml::listDataEx(Distribution::model()->findAllAttributes(null, true))), array('class' => 'CButtonColumn'))));
Пример #10
0
 public function restEvents()
 {
     $this->onRest('req.get.GetBeneficiaryFordistribution.render', function ($distribution_id = "", $subdistribution_id = "", $include = 1, $withall = 0, $withvendor = 0) {
         $include = "not in";
         $criteria = "";
         if (isset($_GET['include']) and $_GET['include'] != 0) {
             $include = "in";
         }
         if (isset($_GET['distribution_id']) and $_GET['distribution_id'] != 0) {
             $distribution = Distribution::model()->findByPk($_GET['distribution_id']);
             $criteria = "id " . $include . " (select distinct ben_id from voucher where distribution_voucher_id in (Select id from distribution_voucher where subdistribution_id in (SELECT id FROM `subdistribution` WHERE distribution_id = " . $_GET['distribution_id'] . ")))";
             if ($_GET['withvendor'] == 1) {
                 $beneficiaries = Beneficiary::model()->findAll($criteria);
                 $count = count($beneficiaries);
                 $count_assigned = 0;
                 $returned_array = [];
                 foreach ($beneficiaries as $beneficiary) {
                     $vendor_id = $beneficiary->getVendor($_GET['distribution_id']);
                     $obj = new stdClass();
                     foreach ($beneficiary as $key => $value) {
                         $obj->{$key} = $value;
                     }
                     $obj->vendor = $vendor_id;
                     if ($obj->vendor != 0) {
                         $count_assigned += 1;
                     }
                     array_push($returned_array, $obj);
                 }
                 echo CJSON::encode(['count_beneficiaries' => $count, 'assigned_beneficiaries' => $count_assigned, 'Beneficiaries' => $returned_array]);
                 Yii::app()->end();
             }
         } elseif (isset($_GET['subdistribution_id']) and $_GET['subdistribution_id'] != 0 and $_GET['include'] != 0) {
             $criteria = "id " . $include . " (select distinct ben_id from voucher where distribution_voucher_id in (Select id from distribution_voucher where subdistribution_id  = " . $_GET['subdistribution_id'] . "))";
             if ($_GET['withall'] != 0) {
                 $included_beneficiaries = Beneficiary::model()->findAll($criteria);
                 $returned_array = [];
                 foreach ($included_beneficiaries as $beneficiary) {
                     $obj = new stdClass();
                     foreach ($beneficiary as $key => $value) {
                         $obj->{$key} = $value;
                     }
                     $obj->available = "false";
                     array_push($returned_array, $obj);
                 }
                 $count_included = count($included_beneficiaries);
                 $subdistribution = Subdistribution::model()->findByPk($_GET['subdistribution_id']);
                 $criteria = "id not in (select distinct ben_id from voucher where distribution_voucher_id in (Select id from distribution_voucher where subdistribution_id in (SELECT id FROM `subdistribution` WHERE distribution_id = " . $subdistribution->distribution_id . ")))";
                 $available_beneficiaries = Beneficiary::model()->findAll($criteria);
                 foreach ($available_beneficiaries as $beneficiary) {
                     $obj = new stdClass();
                     foreach ($beneficiary as $key => $value) {
                         $obj->{$key} = $value;
                     }
                     $obj->available = "true";
                     array_push($returned_array, $obj);
                 }
                 $count_available = count($available_beneficiaries);
                 echo CJSON::encode(['available_beneficiaries' => $count_available, 'included_beneficiaries' => $count_included, 'Beneficiaries' => $returned_array]);
                 Yii::app()->end();
             }
         } elseif (isset($_GET['subdistribution_id']) and $_GET['subdistribution_id'] != 0 and $include == 0) {
             $subdistribution = Subdistribution::model()->findByPk($_GET['subdistribution_id']);
             $criteria = "id " . $include . " (select distinct ben_id from voucher where distribution_voucher_id in (Select id from distribution_voucher where subdistribution_id in (SELECT id FROM `subdistribution` WHERE distribution_id = " . $subdistribution->distribution_id . ")))";
         }
         //echo $criteria;
         $beneficiaries = Beneficiary::model()->findAll($criteria);
         $count = count($beneficiaries);
         //$model = new Beneficiary('searchForVoucherAssignment');
         //$model->unsetAttributes();
         echo CJSON::encode(['count' => $count, 'Beneficiaries' => $beneficiaries]);
     });
 }
Пример #11
0
<?php

$this->breadcrumbs = array(Distribution::label(2), Yii::t('app', 'Index'));
$this->menu = array(array('label' => Yii::t('app', 'Create') . ' ' . Distribution::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Manage') . ' ' . Distribution::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(Distribution::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
Пример #12
0
	<div class="row">
		<?php 
echo $form->label($model, 'region_id');
?>
		<?php 
echo $form->dropDownList($model, 'region_id', GxHtml::listDataEx(Community::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'distribution_id');
?>
		<?php 
echo $form->dropDownList($model, 'distribution_id', GxHtml::listDataEx(Distribution::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'status_id');
?>
		<?php 
echo $form->dropDownList($model, 'status_id', GxHtml::listDataEx(DistributionStatus::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'create_date');
Пример #13
0
		<?php 
echo $form->labelEx($model, 'region_id');
?>
		<?php 
echo $form->dropDownList($model, 'region_id', GxHtml::listDataEx(Community::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'region_id');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'distribution_id');
?>
		<?php 
echo $form->dropDownList($model, 'distribution_id', GxHtml::listDataEx(Distribution::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'distribution_id');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'status_id');
?>
		<?php 
echo $form->dropDownList($model, 'status_id', GxHtml::listDataEx(DistributionStatus::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'status_id');
?>
Пример #14
0
 /**
  * Manage products
  *
  * Add and edit products
  * @access  public
  * @return  string
  * @author  Reto Kohli <*****@*****.**> (parts)
  */
 function view_product_edit()
 {
     global $_ARRAYLANG;
     self::store_product();
     $product_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
     $objProduct = null;
     self::$objTemplate->addBlockfile('SHOP_PRODUCTS_FILE', 'shop_products_block', 'module_shop_product_manage.html');
     self::$objTemplate->setGlobalVariable($_ARRAYLANG);
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     self::$objTemplate->setVariable(array('SHOP_DELETE_ICON' => $cx->getCodeBaseCoreWebPath() . '/Core/View/Media/icons/delete.gif', 'SHOP_NO_PICTURE_ICON' => self::$defaultImage));
     if ($product_id > 0) {
         $objProduct = Product::getById($product_id);
     }
     if (!$objProduct) {
         $objProduct = new Product('', 0, '', '', 0, 1, 0, 0);
     }
     $this->viewpart_product_attributes($product_id);
     $arrImages = Products::get_image_array_from_base64($objProduct->pictures());
     // Virtual Categories are disabled FTTB
     //        $flagsSelection =
     //            ShopCategories::getVirtualCategoriesSelectionForFlags(
     //                $objProduct->flags()
     //            );
     //        if ($flagsSelection) {
     //            self::$objTemplate->setVariable(
     //                'SHOP_FLAGS_SELECTION', $flagsSelection);
     //        }
     //
     // media browser
     $mediaBrowserOptions = array('type' => 'button', 'data-cx-mb-startmediatype' => 'shop', 'data-cx-mb-views' => 'filebrowser', 'id' => 'media_browser_shop', 'style' => 'display:none');
     self::$objTemplate->setVariable(array('MEDIABROWSER_BUTTON' => self::getMediaBrowserButton($mediaBrowserOptions, 'setSelectedImage')));
     $distribution = $objProduct->distribution();
     // Available active frontend groups, and those assigned to the product
     $objGroup = \FWUser::getFWUserObject()->objGroup->getGroups(array('type' => 'frontend', 'is_active' => true), array('group_id' => 'asc'));
     $usergroup_ids = $objProduct->usergroup_ids();
     $arrAssignedFrontendGroupId = explode(',', $usergroup_ids);
     $strActiveFrontendGroupOptions = '';
     $strAssignedFrontendGroupOptions = '';
     while ($objGroup && !$objGroup->EOF) {
         $strOption = '<option value="' . $objGroup->getId() . '">' . htmlentities($objGroup->getName(), ENT_QUOTES, CONTREXX_CHARSET) . '</option>';
         if (in_array($objGroup->getId(), $arrAssignedFrontendGroupId)) {
             $strAssignedFrontendGroupOptions .= $strOption;
         } else {
             $strActiveFrontendGroupOptions .= $strOption;
         }
         $objGroup->next();
     }
     $discount_group_count_id = $objProduct->group_id();
     $discount_group_article_id = $objProduct->article_id();
     $keywords = $objProduct->keywords();
     //die($objProduct->category_id());
     // Product assigned to multiple Categories
     $arrAssignedCategories = ShopCategories::getAssignedShopCategoriesMenuoptions($objProduct->category_id());
     // Date format for Datepicker:
     // Clear the date if none is set; there's no point in displaying
     // "01/01/1970" instead
     $start_date = $end_date = '';
     $start_time = strtotime($objProduct->date_start());
     // Note that the check for ">0" is necessary, as some systems return
     // crazy values for empty dates (it may even fail like this)!
     if ($start_time > 0) {
         $start_date = date(ASCMS_DATE_FORMAT_DATE, $start_time);
     }
     $end_time = strtotime($objProduct->date_end());
     if ($end_time > 0) {
         $end_date = date(ASCMS_DATE_FORMAT_DATE, $end_time);
     }
     //DBG::log("Dates from ".$objProduct->date_start()." ($start_time, $start_date) to ".$objProduct->date_start()." ($end_time, $end_date)");
     $websiteImagesShopPath = $cx->getWebsiteImagesShopPath() . '/';
     $websiteImagesShopWebPath = $cx->getWebsiteImagesShopWebPath() . '/';
     self::$objTemplate->setVariable(array('SHOP_PRODUCT_ID' => isset($_REQUEST['new']) ? 0 : $objProduct->id(), 'SHOP_PRODUCT_CODE' => contrexx_raw2xhtml($objProduct->code()), 'SHOP_PRODUCT_NAME' => contrexx_raw2xhtml($objProduct->name()), 'SHOP_CATEGORIES_ASSIGNED' => $arrAssignedCategories['assigned'], 'SHOP_CATEGORIES_AVAILABLE' => $arrAssignedCategories['available'], 'SHOP_CUSTOMER_PRICE' => contrexx_raw2xhtml(Currency::formatPrice($objProduct->price())), 'SHOP_RESELLER_PRICE' => contrexx_raw2xhtml(Currency::formatPrice($objProduct->resellerprice())), 'SHOP_DISCOUNT' => contrexx_raw2xhtml(Currency::formatPrice($objProduct->discountprice())), 'SHOP_SPECIAL_OFFER' => $objProduct->discount_active() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_MENUOPTIONS' => Vat::getMenuoptions($objProduct->vat_id(), true), 'SHOP_SHORT_DESCRIPTION' => new \Cx\Core\Wysiwyg\Wysiwyg('short', $objProduct->short()), 'SHOP_DESCRIPTION' => new \Cx\Core\Wysiwyg\Wysiwyg('long', $objProduct->long(), 'full'), 'SHOP_STOCK' => $objProduct->stock(), 'SHOP_MIN_ORDER_QUANTITY' => $objProduct->minimum_order_quantity(), 'SHOP_MANUFACTURER_URL' => contrexx_raw2xhtml($objProduct->uri()), 'SHOP_DATE_START' => \Html::getDatepicker('date_start', array('defaultDate' => $start_date), ''), 'SHOP_DATE_END' => \Html::getDatepicker('date_end', array('defaultDate' => $end_date), ''), 'SHOP_ARTICLE_ACTIVE' => $objProduct->active() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_B2B' => $objProduct->b2b() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_B2C' => $objProduct->b2c() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_STOCK_VISIBILITY' => $objProduct->stock_visible() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_MANUFACTURER_MENUOPTIONS' => Manufacturer::getMenuoptions($objProduct->manufacturer_id()), 'SHOP_PICTURE1_IMG_SRC' => !empty($arrImages[1]['img']) && is_file(\ImageManager::getThumbnailFilename($websiteImagesShopPath . $arrImages[1]['img'])) ? contrexx_raw2encodedUrl(\ImageManager::getThumbnailFilename($websiteImagesShopWebPath . $arrImages[1]['img'])) : self::$defaultImage, 'SHOP_PICTURE2_IMG_SRC' => !empty($arrImages[2]['img']) && is_file(\ImageManager::getThumbnailFilename($websiteImagesShopPath . $arrImages[2]['img'])) ? contrexx_raw2encodedUrl(\ImageManager::getThumbnailFilename($websiteImagesShopWebPath . $arrImages[2]['img'])) : self::$defaultImage, 'SHOP_PICTURE3_IMG_SRC' => !empty($arrImages[3]['img']) && is_file(\ImageManager::getThumbnailFilename($websiteImagesShopPath . $arrImages[3]['img'])) ? contrexx_raw2encodedUrl(\ImageManager::getThumbnailFilename($websiteImagesShopWebPath . $arrImages[3]['img'])) : self::$defaultImage, 'SHOP_PICTURE1_IMG_SRC_NO_THUMB' => !empty($arrImages[1]['img']) && is_file($websiteImagesShopPath . $arrImages[1]['img']) ? $websiteImagesShopWebPath . $arrImages[1]['img'] : self::$defaultImage, 'SHOP_PICTURE2_IMG_SRC_NO_THUMB' => !empty($arrImages[2]['img']) && is_file($websiteImagesShopPath . $arrImages[2]['img']) ? $websiteImagesShopWebPath . $arrImages[2]['img'] : self::$defaultImage, 'SHOP_PICTURE3_IMG_SRC_NO_THUMB' => !empty($arrImages[3]['img']) && is_file($websiteImagesShopPath . $arrImages[3]['img']) ? $websiteImagesShopWebPath . $arrImages[3]['img'] : self::$defaultImage, 'SHOP_PICTURE1_IMG_WIDTH' => $arrImages[1]['width'], 'SHOP_PICTURE1_IMG_HEIGHT' => $arrImages[1]['height'], 'SHOP_PICTURE2_IMG_WIDTH' => $arrImages[2]['width'], 'SHOP_PICTURE2_IMG_HEIGHT' => $arrImages[2]['height'], 'SHOP_PICTURE3_IMG_WIDTH' => $arrImages[3]['width'], 'SHOP_PICTURE3_IMG_HEIGHT' => $arrImages[3]['height'], 'SHOP_DISTRIBUTION_MENU' => Distribution::getDistributionMenu($objProduct->distribution(), 'distribution', 'distributionChanged();', 'style="width: 220px"'), 'SHOP_WEIGHT' => $distribution == 'delivery' ? Weight::getWeightString($objProduct->weight()) : '0 g', 'SHOP_GROUPS_AVAILABLE' => $strActiveFrontendGroupOptions, 'SHOP_GROUPS_ASSIGNED' => $strAssignedFrontendGroupOptions, 'SHOP_ACCOUNT_VALIDITY_OPTIONS' => \FWUser::getValidityMenuOptions($distribution == 'download' ? $objProduct->weight() : 0), 'SHOP_CREATE_ACCOUNT_YES_CHECKED' => empty($usergroup_ids) ? '' : \Html::ATTRIBUTE_CHECKED, 'SHOP_CREATE_ACCOUNT_NO_CHECKED' => empty($usergroup_ids) ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DISCOUNT_GROUP_COUNT_MENU_OPTIONS' => Discount::getMenuOptionsGroupCount($discount_group_count_id), 'SHOP_DISCOUNT_GROUP_ARTICLE_MENU_OPTIONS' => Discount::getMenuOptionsGroupArticle($discount_group_article_id), 'SHOP_KEYWORDS' => contrexx_raw2xhtml($keywords), 'SHOP_WEIGHT_ENABLED' => \Cx\Core\Setting\Controller\Setting::getValue('weight_enable', 'Shop') ? 1 : 0));
     return true;
 }
Пример #15
0
 public function actiondeleteVoucherVendor()
 {
     if (isset($_POST) && !empty($_POST)) {
         $distribution = Distribution::model()->findByPk($_POST['distribution_id']);
         $vendor = Vendor::model()->findByPk($_POST['vendor_id']);
         $subdistributions = $distribution->subdistributions;
         $criteria_string = "(0";
         foreach ($subdistributions as $subdistribution) {
             foreach ($subdistribution->distributionVouchers as $ditributioVoucher) {
                 $criteria_string = $criteria_string . ", " . $ditributioVoucher->id;
             }
         }
         $criteria_string = $criteria_string . ")";
         $criteria_string2 = "(0";
         foreach ($_POST['beneficiaries'] as $ben_id) {
             $criteria_string2 = $criteria_string2 . ", " . $ben_id;
         }
         $criteria_string2 = $criteria_string2 . ")";
         $vouchers = Voucher::model()->findAll("vendor_id = " . $vendor->id . " and distribution_voucher_id in " . $criteria_string . " and ben_id in " . $criteria_string2);
         foreach ($vouchers as $voucher) {
             $voucher->vendor_id = NULL;
             $voucher->update();
             $voucher->save();
         }
     }
 }