Пример #1
0
 public function search()
 {
     //$data=$this->calc(3);//incomes
     $accType = Acctype::model()->findAll();
     $data = array();
     $sum = array("id" => '', 'name' => Yii::t("app", "Sub Total"), 'neg' => 0, 'pos' => 0, 'sum' => 0, 'id6111' => '');
     foreach ($accType as $type) {
         //echo $type->id;
         $data = array_merge($data, $this->calc($type->id));
         $data[] = $tmp = array_pop($data);
         $sum['sum'] += $tmp["sum"];
         $sum['neg'] += $tmp["neg"];
         $sum['pos'] += $tmp["pos"];
     }
     $data[] = $sum;
     return new CArrayDataProvider($data, array('pagination' => array('pageSize' => 1000)));
 }
Пример #2
0
 public function calcPay()
 {
     $this->step = 1;
     $this->dates();
     $this->income_sum = Acctype::model()->findByPk(3)->getTotal($this->from_date, $this->to_date);
     $this->tax_rate = Yii::app()->user->settings['company.tax.rate'];
     //$tax
     $this->tax_sum = $this->income_sum * ($this->tax_rate / 100);
     $this->custtax_acc = Yii::app()->user->settings['company.acc.custtax'];
     $this->custtax_sum = Accounts::model()->findByPk($this->custtax_acc)->getTotal($this->from_date, $this->to_date);
     //*-1
     $this->custtax_total = Accounts::model()->findByPk($this->custtax_acc)->getTotal(0, $this->to_date);
     if ($this->custtax_total > $this->tax_sum) {
         $this->custtax_total = $this->tax_sum;
     }
     $this->tax_total = $this->tax_sum + $this->custtax_total;
     return $this->tax_total;
 }
Пример #3
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($type = 0)
 {
     $model = new Accounts();
     $this->performAjaxValidation($model);
     if (isset($_POST['Accounts'])) {
         $model->attributes = $_POST['Accounts'];
         $model->deleteEavAttributes();
         if (isset($_POST['AccounteavE']) && isset($_POST['AccounteavE'])) {
             $model->setEavAttributes(array_combine($_POST['AccounteavE'], $_POST['AccounteavV']));
         }
         if ($model->save()) {
             $this->redirect(array('accounts/index/' . $model->type));
         }
     }
     $model->accType = Acctype::model()->findByPk((int) $type);
     $model->type = $type;
     $this->render('create', array('model' => $model));
 }
Пример #4
0
 public function actionOpenfrmtimport()
 {
     $model = new FormOpenfrmt();
     if (isset($_POST['SwitchType'])) {
         //save current
         //$corComp=Yii::app()->user->Database->id;
         $newComp = (int) $_POST['companyId'];
         //company load
         Company::model()->select($newComp);
         foreach ($_POST['SwitchType'] as $old => $new) {
             Acctype::model()->switchType($old, $new);
         }
         //end
         $this->redirect('company');
     }
     if (isset($_POST['FormOpenfrmt'])) {
         //$yiiUser=Yii::app()->user->id;
         //$configPath=Yii::app()->user->settings["company.path"];
         $file = Company::getFilePath() . "ini.txt";
         $model->iniFile = $_POST['FormOpenfrmt']['iniFile'];
         $model->iniFile = CUploadedFile::getInstance($model, 'iniFile');
         if ($model->iniFile->saveAs($file)) {
             $model->iniFile = $file;
             //$model->read();
         }
         $file = Company::getFilePath() . "/bkmv.txt";
         $model->bkmvFile = $_POST['FormOpenfrmt']['bkmvFile'];
         $model->bkmvFile = CUploadedFile::getInstance($model, 'bkmvFile');
         if ($model->bkmvFile->saveAs($file)) {
             $corComp = Yii::app()->user->Database->id;
             $model->bkmvFile = $file;
             $model->readIni();
             Company::model()->select($model->companyId);
             $model->readBkmv();
             Company::model()->select($corComp);
         }
         $this->render('openfrmtimportajax', array('model' => $model));
         Yii::app()->end();
     }
     $this->render('openfrmtimport', array('model' => $model));
     //echo $model->read();
 }
Пример #5
0
 * ("License"); You may not use this file except in compliance with the Mozilla Public License Version 2.0
 * The Original Code is:  Linet 3.0 Open Source
 * The Initial Developer of the Original Code is Adam Ben Hur.
 * All portions are Copyright (C) Adam Ben Hur.
 * All Rights Reserved.
 ************************************************************************************/
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'bank-name-form', 'enableAjaxValidation' => false));
?>

	<?php 
echo $form->errorSummary($model);
?>

	<?php 
//echo $form->textFieldRow($model,'id',array('class'=>'span5'));
?>

	<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 255));
?>
        <?php 
echo $form->dropDownListRow($model, 'type_id', CHtml::listData(Acctype::model()->findAll(), 'id', 'name'));
?>
	<div class="form-actions">
		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? Yii::t('app', "Create") : Yii::t('app', "Save")));
?>
	</div>

<?php 
$this->endWidget();
Пример #6
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'acc-template-form', 'enableAjaxValidation' => false));
?>

<?php 
echo $form->errorSummary($model);
?>

<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 255));
?>

<?php 
$models = Acctype::model()->findAll(array('order' => 'name'));
//$list = CHtml::listData($models, 'id', 'name');
//$htmlOptions = array("class" => 'span5', 'id' => ucfirst($this->id) . '_AccType_id');
//$select = CHtml::dropDownList(ucfirst($this->id) . '[AccType_id]', 0, $list, $htmlOptions);
echo $form->dropDownListRow($model, 'AccType_id', CHtml::listData($models, 'id', 'name'));
?>

<?php 
//echo $form->textFieldRow($model,'AccType_id',array('class'=>'span5'));
if (isset($items)) {
    $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('app', 'Add new'), 'type' => 'primary', 'htmlOptions' => array('onclick' => '$("#addnew").dialog("open"); return false;')));
    $this->widget('EExcelView', array('id' => 'acc-templateItem-grid', 'dataProvider' => $items->search(), 'filter' => $items, 'columns' => array(array('name' => 'eavFields_id', 'value' => '$data->EavFields->name'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{remove}', 'buttons' => array('remove' => array('label' => '<i class="glyphicon glyphicon-remove"></i>', 'url' => '$data->id', 'options' => array('onclick' => 'deleteTempItm(this);return false;')))))));
}
?>


Пример #7
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Acctype::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #8
0
<?php

$form = kartik\form\ActiveForm::begin(array('id' => 'acc-template-form', 'enableAjaxValidation' => false));
?>

<?php 
echo $form->errorSummary($model);
?>

<?php 
echo $form->field($model, 'name');
?>

<?php 
$models = Acctype::find()->All();
//array('order' => 'name')
//$list = \yii\helpers\ArrayHelper::map($models, 'id', 'name');
//$options = array("class" => 'span5', 'id' => ucfirst($this->id) . '_AccType_id');
//$select = \yii\helpers\Html::dropDownList(ucfirst($this->id) . '[AccType_id]', 0, $list, $options);
echo $form->field($model, 'AccType_id')->widget(Select2::className(), ['data' => \yii\helpers\ArrayHelper::map($models, 'id', 'name')]);
?>

<?php 
//echo $form->field($model,'AccType_id',array('class'=>'span5'));
if (isset($items)) {
    $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('app', 'Add new'), 'type' => 'success', 'options' => array('onclick' => '$("#addnew").dialog("open"); return false;')));
    echo app\widgets\GridView::widget(array('id' => 'acc-templateItem-grid', 'dataProvider' => $items->search(), 'filter' => $items, 'columns' => array(array('attribute' => 'eavFields_id', 'value' => '$data->EavFields->name'), array('class' => 'yii\\grid\\ActionColumn', 'template' => '{remove}', 'buttons' => array('remove' => array('label' => '<i class="glyphicon glyphicon-remove"></i>', 'url' => '$data->id', 'options' => array('onclick' => 'deleteTempItm(this);return false;')))))));
}
?>

Пример #9
0
	</div>

<?php 
$this->endWidget();
?>

<script type="text/javascript">
    $("#MailTemplate_entity_type").change(function(){
        change();
    });
    
    
    
function change(){
    var accList=<?php 
echo CJSON::encode(CHtml::listData(Acctype::model()->findAll(), 'id', 'name'));
?>
;
    var docList=<?php 
echo CJSON::encode(CHtml::listData(Doctype::model()->findAll(), 'id', 'name'));
?>
;
    //console.log(docList.length);
    if($("#MailTemplate_entity_type").val()=='Acctype'){
        loadList(accList);
    }else{
        loadList(docList);   
    }
        
}    
Пример #10
0
echo Yii::t('app', 'To Date');
$this->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => 'to_date', 'mode' => 'date', 'language' => substr(Yii::app()->language, 0, 2), 'options' => array('showAnim' => 'fold', 'dateFormat' => Yii::app()->locale->getDateFormat('short'))));
?>
        <?php 
echo $form->textFieldRow($model, 'acc');
?>
        <?php 
echo Yii::t('app', 'Examples');
?>
: <br/>
        1-200<br/>
        1,3,5<br/>
        1-10,15-20,25-30<br/>
        
        <?php 
$temp = CHtml::listData(Acctype::model()->findAll(), 'id', 'name');
$temp[""] = Yii::t('app', 'Choose Type');
echo $form->dropDownListRow($model, 'type', $temp);
?>
        <div class="row form-actions">
        <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', "icon" => "glyphicon glyphicon-eye-open", 'label' => Yii::t('app', "Search")));
?>
            <?php 
$this->widget('bootstrap.widgets.TbButton', array('type' => 'primary', 'buttonType' => 'ajaxButton', "icon" => "glyphicon glyphicon-print", 'label' => Yii::t('app', "Print")));
?>
        </div>



    </div>
Пример #11
0
 public function getType($name)
 {
     $model = Acctype::model()->find('name=:name', array(':name' => $name));
     //print_r($this);
     //$post=Post::model()->find('postID=:postID', array(':postID'=>10));
     return $model->id;
 }
Пример #12
0
?>

<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'accounts-form', 'enableAjaxValidation' => true, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>

    <?php 
echo $form->errorSummary($model);
?>
    
   
    <?php 
echo CHtml::hiddenField("companyId", $model->companyId);
foreach ($model->accDesc as $type => $desc) {
    //$model->accTypeIndex[$type];
    //echo $form->dropDownListRow($model,'id6111',CHtml::listData(AccId6111::model()->findAll(), 'id', 'name'));
    echo CHtml::dropDownList("SwitchType[" . $model->accTypeIndex[$type] . "]", 0, CHtml::listData(Acctype::model()->findAll(), 'id', 'name'));
    echo $desc . "<br/>";
    // $this->accDesc[$acc->type]=$acc->name;
}
?>

    <div class="form-actions">
            <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('app', "Go")));
?>
    </div>

<?php 
$this->endWidget();
$this->endWidget();
Пример #13
0
 * ("License"); You may not use this file except in compliance with the Mozilla Public License Version 2.0
 * The Original Code is:  Linet 3.0 Open Source
 * The Initial Developer of the Original Code is Adam Ben Hur.
 * All portions are Copyright (C) Adam Ben Hur.
 * All Rights Reserved.
 * ********************************************************************************** */
$this->menu = array(array('label' => Yii::t('app', 'Create Account'), 'url' => array('create')));
?>


<?php 
$this->beginWidget('MiniForm', array('header' => Yii::t('app', "Accounts")));
?>

<?php 
$types = Acctype::model()->findAll();
$list = array();
foreach ($types as $type1) {
    $list[Yii::t('app', $type1->desc)] = array('id' => $type1->id, 'ajax' => $this->createUrl('accounts/index?ajax=accounts-grid&type=' . $type1->id));
}
$this->widget('zii.widgets.jui.CJuiTabs', array('tabs' => $list, 'headerTemplate' => '<li><a id="{id}" href="{url}" title="{title}">{title}</a></li>', 'options' => array('active' => $type)));
//*/
$this->endWidget();
echo CHTML::hiddenField("accType", $type);
?>

<script type="text/javascript" src="<?php 
echo Yii::app()->createAbsoluteUrl('/assets/8b529727/jquery.ba-bbq.js');
?>
"></script>
<script type="text/javascript" src="<?php 
Пример #14
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Acctype::findOne($id);
     if ($model === null) {
         throw new \yii\web\HttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }