示例#1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($type = 1)
 {
     $type = isset($_POST['Docs']['doctype']) ? (int) $_POST['Docs']['doctype'] : $type;
     $model = new Docs();
     $model->doctype = $type;
     $model->docType = Doctype::model()->findByPk($type);
     if (!is_null($model->docType->oppt_account_type)) {
         $model->scenario = "opppt_req";
     }
     if ($model->docType->id == 9) {
         //invrcpt
         $model->scenario = "invrcpt";
     }
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['Docs'])) {
         $model->attributes = $_POST['Docs'];
         if (isset($_POST['Docdetails'])) {
             $model->docDet = $_POST['Docdetails'];
         }
         if (isset($_POST['Doccheques'])) {
             $model->docCheq = $_POST['Doccheques'];
         }
         return $this->doc($model);
     }
     $model->status = $model->docType->docStatus_id;
     $model->description = $model->docType->footer;
     $this->render('create', array('model' => $model));
 }
示例#2
0
 public function import()
 {
     //add warehouse
     $array = $this->read();
     //companies
     $company = $this->parseLine($array['companies'][0]);
     $prefix = $company[1];
     //echo $prefix;
     $this->saveSetting('company.name', $company[0]);
     $this->saveSetting('company.vat.id', $company[3]);
     $this->saveSetting('company.address', $company[4]);
     $this->saveSetting('company.city', $company[5]);
     $this->saveSetting('company.zip', $company[6]);
     $this->saveSetting('company.phone', $company[7]);
     $this->saveSetting('company.fax', $company[8]);
     $this->saveSetting('company.website', $company[9]);
     $this->saveSetting('company.tax.rate', $company[10]);
     $this->saveSetting('company.tax.irs', $company[11]);
     //$this->saveSetting('account.100.srctax', $company[12]);
     $this->saveSetting('company.tax.vat', $company[13]);
     //exit;
     ///*
     if (isset($array['accounts'])) {
         $this->imprtAccounts($array['accounts'], $prefix);
     }
     if (isset($array['items'])) {
         $this->imprtItems($array['items'], $prefix);
     }
     if (isset($array['docs'])) {
         $this->imprtDocs($array['docs'], $prefix);
     }
     if (isset($array['cheques'])) {
         $this->imprtCheques($array['cheques'], $prefix);
     }
     if (isset($array['docdetails'])) {
         $this->imprtDocdetails($array['docdetails'], $prefix);
     }
     if (isset($array['transactions'])) {
         $this->imprtTransactions($array['transactions'], $prefix);
     }
     if (isset($array['bankbook'])) {
         $this->imprtBankbooks($array['bankbook'], $prefix);
     }
     if (isset($array['correlation'])) {
         $this->imprtCorrelations($array['correlation'], $prefix);
     }
     //*/
     //vat rate
     $acc = Accounts::model()->findByPk(100);
     $acc->src_tax = $company[12];
     $acc->save();
     $acc = Accounts::model()->findByPk(101);
     $acc->src_tax = $company[12];
     $acc->save();
     //add warehouse
     //add genral item
     //get transaction num
     $this->saveSetting('company.transaction', Transactions::getMax() + 1);
     //get docnums
     $types = Doctype::model()->findAll();
     foreach ($types as $type) {
         $type->last_docnum = Docs::getMax($type->id);
         $type->save();
     }
     //contacthist
     //contacts??
     //tranrep??
 }
示例#3
0
 public function docsTable()
 {
     $array = array();
     if (isset($this->docArr)) {
         foreach ($this->docArr as $key => $value) {
             $tmp = OpenFormatType::model()->findByPk(array('id' => $key, 'type' => 'INI'));
             //echo OpenFormatType::model()->findByPk($key)->description;
             if ($tmp) {
                 print_r($tmp);
             }
             $array[] = array('id' => $key, 'name' => Doctype::model()->getOpenType($key), 'count' => $value, 'sum' => $this->docSumArr[$key]);
         }
     }
     return new CArrayDataProvider($array, array('pagination' => array('pageSize' => 100)));
 }
示例#4
0
文件: Docs.php 项目: hkhateb/linet3
 public function getType($type = '')
 {
     if ($type == '') {
         return isset($this->docType) ? $this->docType->openformat : "";
     } else {
         $this->doctype = Doctype::model()->getOType($type);
         return $this->doctype;
     }
 }
示例#5
0
文件: _form.php 项目: hkhateb/linet3
?>

<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);   
    }
        
}    

function loadList(list){
    
    $("#MailTemplate_entity_id")
            .find('option')
示例#6
0
文件: _list.php 项目: hkhateb/linet3
<?php

/* * *********************************************************************************
 * The contents of this file are subject to the Mozilla Public License Version 2.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 is the date picker
$dateisOn = $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'Docs[issue_from]', 'language' => substr(Yii::app()->language, 0, 2), 'value' => $model->issue_from, 'options' => array('showAnim' => 'fold', 'dateFormat' => Yii::app()->locale->getDateFormat('short'), 'changeMonth' => 'true', 'changeYear' => 'true', 'constrainInput' => 'false'), 'htmlOptions' => array('placeholder' => Yii::t('app', 'From Date'))), true) . $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'Docs[issue_to]', 'language' => substr(Yii::app()->language, 0, 2), 'value' => $model->issue_to, 'options' => array('showAnim' => 'fold', 'dateFormat' => Yii::app()->locale->getDateFormat('short'), 'changeMonth' => 'true', 'changeYear' => 'true', 'constrainInput' => 'false'), 'htmlOptions' => array('placeholder' => Yii::t('app', 'To Date'))), true);
?>



<?php 
$filter = '';
if ($model->doctype != null) {
    $filter = CHtml::listData(Docstatus::model()->findAllByAttributes(array('doc_type' => $model->doctype)), 'num', 'name');
} else {
    $model->status = null;
}
//print_r(Yii::app()->locale);
$this->widget('EExcelView', array('id' => 'Docs', 'dataProvider' => $model->search(), 'filter' => $model, 'ajaxUpdate' => true, 'ajaxType' => 'POST', 'afterAjaxUpdate' => "function() {\n\t\t\t\t\t\tjQuery('#Docs_issue_from').datepicker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['" . substr(Yii::app()->language, 0, 2) . "'], {'showAnim':'fold','dateFormat':'" . Yii::app()->locale->getDateFormat('short') . "','changeMonth':'true','showButtonPanel':'true','changeYear':'true','constrainInput':'false'}));\n\t\t\t\t\t\tjQuery('#Docs_issue_to').datepicker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['" . substr(Yii::app()->language, 0, 2) . "'], {'showAnim':'fold','dateFormat':'" . Yii::app()->locale->getDateFormat('short') . "','changeMonth':'true','showButtonPanel':'true','changeYear':'true','constrainInput':'false'}));\n                                }", 'columns' => array(array('name' => 'doctype', 'filter' => Doctype::model()->getList(), 'value' => '$data->getTypeName()', 'htmlOptions' => array('style' => 'width:20%;')), array('name' => 'status', 'filter' => $filter, 'value' => '$data->getStatus()'), array('name' => 'refstatus', 'filter' => CHtml::listData(Docs::model()->getRefStatuses(), 'id', 'name'), 'value' => '$data->getRefStatus()'), array('name' => 'docnum', 'htmlOptions' => array('style' => 'width:8%;')), array('name' => 'account_id', 'htmlOptions' => array('style' => 'width:8%;')), 'company', array('name' => 'issue_date', 'filter' => $dateisOn, 'value' => '$data->issue_date', 'htmlOptions' => array('style' => 'width:15%;')), array('name' => 'total', 'htmlOptions' => array('style' => 'width:8%;')), array('class' => 'bootstrap.widgets.TbButtonColumn', 'htmlOptions' => array('style' => 'width:80px'), 'template' => '{duplicate}{print}{edit}{delete}{display}', 'buttons' => array('duplicate' => array('label' => '<i class="glyphicon glyphicon-plus-sign"></i>', 'url' => 'Yii::app()->createUrl("docs/duplicate/". $data->id)'), 'edit' => array('label' => '<i class="glyphicon glyphicon-edit"></i>', 'url' => 'Yii::app()->createUrl("docs/update", array("id"=>$data->id))'), 'delete' => array('label' => '<i class="glyphicon glyphicon-remove"></i>', 'deleteConfirmation' => true, 'imageUrl' => false, 'url' => 'Yii::app()->createUrl("docs/delete", array("id"=>$data->id))'), 'print' => array('label' => '<i class="glyphicon glyphicon-print"></i>', 'url' => 'Yii::app()->createUrl("docs/print", array("id"=>$data->id))', 'options' => array("target" => "_blank")), 'display' => array('label' => '<i class="glyphicon glyphicon-search"></i>', 'url' => 'Yii::app()->createUrl("docs/view", array("id"=>$data->id))'))))));
示例#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 = Doctype::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#8
0
文件: index.php 项目: hkhateb/linet3
<?php

/* * *********************************************************************************
 * The contents of this file are subject to the Mozilla Public License Version 2.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.
 * ********************************************************************************** */
$model = new Docs('search');
$model->unsetAttributes();
if (isset($_GET['Docs'])) {
    $model->attributes = $_GET['Docs'];
}
//$var=CHtml::link(CHtml::encode($data->docnum),"#", array("onclick"=>'refNum('.CJSON::encode($data).')'));
$this->widget('EExcelView', array('id' => 'docs-grid', 'dataProvider' => $model->search(), 'template' => '{items}{pager}', 'filter' => $model, 'columns' => array(array('name' => 'doctype', 'filter' => CHtml::listData(Doctype::model()->findAll(), 'id', 'name'), 'value' => '$data->getTypeName()', 'htmlOptions' => array('style' => 'width:35%;')), array('name' => 'docnum', 'value' => 'CHtml::link(CHtml::encode($data->docnum),"#", array("onclick"=>\'refNum(\'.CJSON::encode($data).\')\'));', 'type' => 'raw', 'htmlOptions' => array('style' => 'width:5%;')), 'company', array('name' => 'status', 'value' => '$data->getStatus()', 'htmlOptions' => array('style' => 'width:8%;')), array('name' => 'total', 'htmlOptions' => array('style' => 'width:8%;')))));
?>

示例#9
0
 public function getOType($type)
 {
     $model = Doctype::model()->find('openformat=:openformat', array(':openformat' => $type));
     //$post=Post::model()->find('postID=:postID', array(':postID'=>10));
     if ($model === null) {
         return 0;
     }
     return $model->id;
 }