function myHeader($acc_id, $begin_date, $end_date)
 {
     $this->y0 = $this->GetY();
     //$this->Image('css/LOGO.jpg',15,7,30);
     $this->SetY($this->y0);
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 5, Yii::app()->name, 0, 0, 'R');
     $this->Ln();
     $this->Cell(190, 0, '', 'B');
     $this->Ln();
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 8, 'JOURNAL VOUCHER LIST', '', 0, 'C');
     $this->Ln();
     $this->Cell(190, 0, '', 'B');
     $this->Ln();
     $this->SetFont('Arial', '', 10);
     $this->Cell(25, 4, 'Account No', 'L');
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(0, 4, ': ' . tAccount::model()->findByPk($acc_id)->account_concat(), 'R');
     $this->Ln();
     $this->SetFont('Arial', '', 10);
     $this->Cell(25, 4, 'Periode: ', 'L');
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(0, 4, ': ' . $begin_date . " to " . $end_date, 'R');
     $this->Ln();
     $this->Cell(190, 0, '', 'B');
     $this->Ln(8);
 }
         $results = $index->find($term);
         $query = Zend_Search_Lucene_Search_QueryParser::parse($term);
         $this->render('/sParameter/search', compact('results', 'term', 'query'));
     }
 }
 /**
  * Search index creation
  */
 public function actionCreate()
 {
     $index = new Zend_Search_Lucene(Yii::getPathOfAlias('application.' . $this->_indexFiles), true);
     $posts = tAccount::model()->findAll();
     foreach ($posts as $post) {
         $doc = new Zend_Search_Lucene_Document();
         $doc->addField(Zend_Search_Lucene_Field::Text('account_no', CHtml::encode($post->account_no), 'utf-8'));
 function myHeader($acc_id, $begin_date, $end_date)
 {
     $this->y0 = $this->GetY();
     //$this->Image('css/LOGO.jpg',15,7,30);
     $this->SetY($this->y0);
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 5, Yii::app()->name, 0, 0, 'R');
     $this->Ln();
     $this->Cell(190, 0, '', 'B');
     $this->Ln();
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 8, 'JOURNAL VOUCHER LIST', '', 0, 'C');
     $this->Ln();
     $this->Cell(190, 0, '', 'B');
     $this->Ln();
     $this->SetFont('Arial', '', 10);
     $this->Cell(25, 4, 'Account No', 'L');
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(0, 4, ': ' . tAccount::model()->findByPk($acc_id)->account_concat(), 'R');
     $this->Ln();
     $this->SetFont('Arial', '', 10);
     $this->Cell(25, 4, 'Periode: ', 'L');
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(0, 4, ': ' . $begin_date . " to " . $end_date, 'R');
     $this->Ln();
     $this->Cell(190, 0, '', 'B');
     $this->Ln(8);
     $w = array(7, 18, 14, 33, 18, 18, 70, 15);
     //Header
     $this->SetFont('Arial', '', 8);
     $this->Cell($w[0], 8, 'No.', 1, 0, 'R');
     $this->Cell($w[1], 8, 'Date', 1);
     $this->Cell($w[2], 8, 'Period', 1);
     $this->Cell($w[3], 8, 'No. Ref', 1);
     $this->Cell($w[4], 8, 'Debit', 1);
     $this->Cell($w[5], 8, 'Credit', 1);
     $this->Cell($w[6], 8, 'User Remark', 1);
     $this->Cell($w[7], 8, 'Status', 1);
     $this->Ln();
     $this->Cell(array_sum($w), 1, '', 'TB');
     $this->Ln(1);
 }
    public function labarugiExecution()
    {
        $_curPeriod = Yii::app()->settings->get("System", "cCurrentPeriod");
        $_labarugi = tAccount::netprofit($_curPeriod);
        $_lraccount = tAccount::model()->with('accmain')->find('accmain.mvalue=8')->id;
        $modelBalanceCurrent = tBalanceSheet::model()->find(array('condition' => 'parent_id =' . $_lraccount . ' AND yearmonth_periode = ' . $_curPeriod));
        if ($modelBalanceCurrent == null) {
            //New Account on This Period
            $sql = 'INSERT INTO t_balance_sheet (parent_id, yearmonth_periode, type_balance_id, remark, budget, beginning_balance,debit,credit,end_balance) VALUES (' . $_lraccount . ',' . $_curPeriod . ', 1, "Automated posted", 0,' . $_labarugi . ',0,0,' . $_labarugi . ')';
        } else {
            $_labarugi = $_labarugi + $modelBalanceCurrent->beginning_balance;
            $sql = 'UPDATE t_balance_sheet SET
			debit = 0,
			credit = 0,
			end_balance = ' . $_labarugi . '
			WHERE yearmonth_periode = ' . $_curPeriod . ' AND parent_id = ' . $_lraccount;
        }
        $command = Yii::app()->db->createCommand($sql);
        $command->execute();
    }
 function report($periode_date, $report_id)
 {
     $this->myheader($periode_date, $report_id);
     $w = array(100, 20);
     $_s = 5;
     $_subtotal = 0;
     $criteria = new CDbCriteria();
     $criteria->with = array('cashbank', 'entity');
     $criteria->order = 'account_no';
     $models = tAccount::model()->findAll($criteria);
     $this->SetFont('Arial', 'B', 8);
     $this->Cell($w[0], 4, 'Account Cash Bank, Beginning Balance');
     $this->SetX($this->x0);
     $this->Ln();
     foreach ($models as $model) {
         $this->SetFont('Arial', '', 8);
         $this->Cell($_s, 4, '');
         $this->Cell($w[0], 4, $model->account_concat());
         $this->SetX($this->x0);
         $_model = $model->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
         if (isset($_model->end_balance)) {
             $_balance = number_format($_model->end_balance, 0, ',', '.');
             $_subtotal = $_subtotal + $_model->end_balance;
         } else {
             $_balance = 0;
         }
         $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
         $this->Ln();
     }
     $this->SetFont('Arial', 'B', 8);
     //$this->Cell($_s,4,'');
     $this->Cell($w[0], 4, 'TOTAL ' . $model->account_name);
     $this->SetX($this->x0);
     $this->Cell($w[1], 4, number_format($_subtotal, 0, ',', '.'), 'T', 0, 'R');
     $this->Ln(5);
     $model = $this->penerimaan();
 }
Ejemplo n.º 6
0
<?php

$this->breadcrumbs = array('Chart of Accounts' => array('index'), 'Create');
$this->menu = array(array('label' => 'Home', 'url' => array('index')));
$this->menu1 = tAccount::getTopUpdated();
$this->menu2 = tAccount::getTopCreated();
?>

<div class="page-header">
	<h1>Create New Root Account</h1>
</div>

<?php 
echo $this->renderPartial('_formroot', array('model' => $model));
Ejemplo n.º 7
0
		'options'=>array('icons'=>'js:{secondary:"ui-icon-extlink"}'),
));
?>
</p>
<br/>
*/
?>

<?php 
$this->widget('DropDownRedirect', array('data' => tAccount::accountDetail(), 'url' => $this->createUrl($this->route, array_merge($_GET, array('acc' => '__value__'))), 'select' => isset($_GET['acc']) ? $_GET['acc'] : "ALL"));
echo CHtml::link('Refresh', $this->createUrl($this->route, $_GET));
?>

<br />
<?php 
if (isset($_GET['acc'])) {
    if ($_GET['acc'] != null) {
        echo "<b><p style='display: block;margin: 5px 0;padding: 2px;background-color: yellow;'>";
        echo "Current Filter :  " . tAccount::model()->findByPk((int) $_GET['acc'])->account_name;
        echo "</p></b>";
        echo "</br>";
    }
}
?>
</b>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'template' => '{items}', 'itemView' => '_view'));
?>

    ?>
</td>
			<td><?php 
    echo CHtml::textField('user_remark[]', '', array());
    ?>
</td>
		</tr>
		<?php 
} else {
    ?>
		<?php 
    for ($i = 0; $i < sizeof($model->account_no_id); ++$i) {
        ?>
		<tr>
			<td><?php 
        echo CHtml::dropDownList('account_no_id[]', $model->account_no_id[$i], tAccount::item(), array());
        ?>
			</td>
			<td><?php 
        echo CHtml::textField('debit[]', $model->debit[$i], array());
        ?>
			</td>
			<td><?php 
        echo CHtml::textField('credit[]', $model->credit[$i], array());
        ?>
			</td>
			<td><?php 
        echo CHtml::textField('user_remark[]', $model->user_remark[$i], array());
        ?>
			</td>
		</tr>
?>
		Print List Journal
	</h1>
</div>

<?php 
$form = $this->beginWidget('BootActiveForm', array('id' => 'allocation-form', 'type' => 'horizontal', 'enableAjaxValidation' => false));
?>


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

<?php 
echo $form->dropDownListRow($model, 'account_no_id', tAccount::item());
?>

	<?php 
echo $form->textFieldRow($model, 'begindate');
?>
	<?php 
echo $form->textFieldRow($model, 'enddate');
?>

<?php 
/*
$this->widget('ext.monthpicker.MonthPicker', array(
    'model'=>$model,
    'name'=>'begindate',
));
Ejemplo n.º 10
0
echo CHtml::image(Yii::app()->request->baseUrl . '/images/icon/bank.png');
?>
		Cash and Bank
	</h1>
</div>


<?php 
$this->widget('DropDownRedirect', array('data' => tAccount::cashBankAccount("ALL"), 'url' => $this->createUrl($this->route, array_merge($_GET, array('pid' => '__value__'))), 'select' => isset($_GET['pid']) ? $_GET['pid'] : "(ALL)", 'htmlOptions' => array('class' => 'span4')));
?>

<?php 
if (isset($_GET['pid'])) {
    if ((int) $_GET['pid'] != 0) {
        echo "<b><p style='display: block;margin: 5px 0;padding: 2px;background-color: yellow;'>";
        echo "Filter By: " . tAccount::model()->findByPk((int) $_GET['pid'])->account_name;
        echo "</p></b>";
    }
}
?>

<div id="posts">
<?php 
foreach ($dataProvider as $data) {
    ?>
    <div class="post">
		<?php 
    echo $this->renderPartial('/uJournal/_view', array('data' => $data));
    ?>
    </div>
<?php 
	<li class="nav-header">Cash and Bank</li>
</ul>
<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => uJournal::getTopUpdated(2)));
?>
<br />

<ul class="nav nav-list">
	<li class="nav-header">PO (Unapproved)</li>
</ul>
<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => bPorder::getTopUnApprovedPO()));
?>
<br />

<ul class="nav nav-list">
	<li class="nav-header">PO (Unpaid)</li>
</ul>
<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => bPorder::getTopUnPaidPO()));
?>
<br />

<ul class="nav nav-list">
	<li class="nav-header">Chart Of Account</li>
</ul>
<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => tAccount::getTopUpdated()));
?>
<br />
<?php

$Hierarchy = tAccount::model()->findAll(array('condition' => 'parent_id = 0'));
foreach ($Hierarchy as $Hierarchy) {
    $models = tAccount::model()->findByPk($Hierarchy->id);
    $items[] = $models->getTree();
}
$this->beginWidget('CTreeView', array('id' => 'module-tree', 'url' => array('/tAccount/ajaxFillTree')));
$this->endWidget();
 function report($periode_date, $report_id)
 {
     $this->myheader($periode_date, $report_id);
     $w = array(100, 20);
     $model1 = tAccountMain::model()->with('account_list')->findAll('type_id= 2');
     $_s = 3;
     //Reset
     $_total = 0;
     $_subtotal = 0;
     $_grandtotal = 0;
     $_grandtotalI = 0;
     $_grandtotalH = 0;
     $_grandtotalE = 0;
     $_totalLast = 0;
     $_subtotalLast = 0;
     $_grandtotalLast = 0;
     $_grandtotalILast = 0;
     $_grandtotalHLast = 0;
     $_grandtotalELast = 0;
     //Print/Preview Report
     foreach ($model1 as $mmm) {
         foreach ($mmm->account_list as $mm) {
             $model2 = tAccount::model()->findByPk((int) $mm->parent_id);
             $this->SetFont('Arial', 'B', 8);
             if ($mmm->id == 2) {
                 $this->Cell(5, 4, '');
             }
             $this->Cell($w[0], 4, $model2->account_concat());
             $this->SetX($this->x0);
             $this->Cell($w[1], 4, '');
             $this->Ln();
             foreach ($model2->childs as $model) {
                 if ($model->childs) {
                     $this->SetFont('Arial', 'B', 8);
                 } else {
                     $this->SetFont('Arial', '', 8);
                 }
                 $this->Cell($_s, 4, '');
                 $this->Cell($w[0], 4, $model->account_concat());
                 $this->SetX($this->x0);
                 $_model = $model->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                 $_periode_date_last = sParameter::cBeginDateBefore($periode_date);
                 $_modelLast = $model->balancesheet(array('condition' => 'yearmonth_periode =' . $_periode_date_last));
                 if (isset($_model->end_balance)) {
                     $_balance = number_format($_model->end_balance, 0, ',', '.');
                     $_mmodelLast = isset($_modelLast->end_balance) ? $_modelLast->end_balance : 0;
                     $_balanceLast = number_format($_mmodelLast, 0, ',', '.');
                     $_subtotal = $_subtotal + $_model->end_balance;
                     $_grandtotal = $_grandtotal + $_model->end_balance;
                     $_subtotalLast = $_subtotalLast + $_mmodelLast;
                     $_grandtotalLast = $_grandtotalLast + $_mmodelLast;
                 } else {
                     $_balance = 0;
                     $_balanceLast = 0;
                 }
                 if ($model->childs) {
                     $this->Cell($w[1], 4, '', 0, 0, 'R');
                 } else {
                     $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                     $this->Cell($w[1] + 20, 4, $_balanceLast, 0, 0, 'R');
                 }
                 $this->Ln();
                 if ($model->childs) {
                     foreach ($model->childs as $mod) {
                         if ($mod->childs) {
                             $this->SetFont('Arial', 'B', 8);
                         } else {
                             $this->SetFont('Arial', '', 8);
                         }
                         $this->Cell($_s + 3, 4, '');
                         $this->Cell($w[0], 4, $mod->account_concat());
                         $this->SetX($this->x0);
                         $_mod = $mod->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                         $_modLast = $mod->balancesheet(array('condition' => 'yearmonth_periode =' . $_periode_date_last));
                         if (isset($_mod->end_balance)) {
                             $_balance = number_format($_mod->end_balance, 0, ',', '.');
                             $_mmodLast = isset($_modLast->end_balance) ? $_modLast->end_balance : 0;
                             $_balanceLast = number_format($_mmodLast, 0, ',', '.');
                             $_subtotal = $_subtotal + $_mod->end_balance;
                             $_grandtotal = $_grandtotal + $_mod->end_balance;
                             $_subtotalLast = $_subtotalLast + $_mmodLast;
                             $_grandtotalLast = $_grandtotalLast + $_mmodLast;
                         } else {
                             $_balance = 0;
                             $_balanceLast = 0;
                         }
                         if ($mod->childs) {
                             $this->Cell($w[1], 4, '', 0, 0, 'R');
                         } else {
                             $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                             $this->Cell($w[1] + 20, 4, $_balanceLast, 0, 0, 'R');
                         }
                         $this->Ln();
                         if ($mod->childs) {
                             foreach ($mod->childs as $m) {
                                 $this->SetFont('Arial', '', 8);
                                 $this->Cell($_s + 10, 4, '');
                                 $this->Cell($w[0], 4, $m->account_concat());
                                 $this->SetX($this->x0);
                                 $_m = $m->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                                 $_mLast = $m->balancesheet(array('condition' => 'yearmonth_periode =' . $_periode_date_last));
                                 $_mmLast = isset($_mLast->end_balance) ? $_mLast->end_balance : 0;
                                 if (isset($_m->end_balance)) {
                                     $_balance = number_format($_m->end_balance, 0, ',', '.');
                                     $_balanceLast = number_format($_mmLast, 0, ',', '.');
                                     $_total = $_total + $_m->end_balance;
                                     $_subtotal = $_subtotal + $_m->end_balance;
                                     $_grandtotal = $_grandtotal + $_m->end_balance;
                                     $_totalLast = $_totalLast + $_mmLast;
                                     $_subtotalLast = $_subtotalLast + $_mmLast;
                                     $_grandtotalLast = $_grandtotalLast + $_mmLast;
                                 } else {
                                     $_balance = 0;
                                     $_balanceLast = 0;
                                 }
                                 if ($m->childs) {
                                     $this->Cell($w[1], 4, '', 0, 0, 'R');
                                 } else {
                                     $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                                     $this->Cell($w[1] + 20, 4, $_balanceLast, 0, 0, 'R');
                                 }
                                 $this->Ln();
                             }
                         }
                         if ($mod->childs) {
                             $this->SetFont('Arial', 'B', 8);
                             $this->Cell($_s + 3, 4, '');
                             $this->Cell($w[0], 4, 'TOTAL ' . $mod->account_name);
                             $this->SetX($this->x0);
                             $this->Cell($w[1], 4, number_format($_total, 0, ',', '.'), 'T', 0, 'R');
                             $this->Cell($w[1], 4, '', '');
                             $this->Cell($w[1], 4, number_format($_totalLast, 0, ',', '.'), 'T', 0, 'R');
                             $this->Ln(5);
                             $_total = 0;
                             $_totalLast = 0;
                             if ($this->GetY() >= 250) {
                                 $this->AddPage();
                                 $this->myheader($periode_date, $report_id);
                             }
                         }
                     }
                 }
                 if ($model->childs && $model->childsCount >= 2) {
                     $this->SetFont('Arial', 'B', 8);
                     $this->Cell($_s, 4, '');
                     $this->Cell($w[0], 4, 'TOTAL ' . $model->account_name);
                     $this->SetX($this->x0);
                     $this->Cell($w[1], 4, number_format($_subtotal, 0, ',', '.'), 'T', 0, 'R');
                     $this->Cell($w[1], 4, '', 0);
                     $this->Cell($w[1], 4, number_format($_subtotalLast, 0, ',', '.'), 'T', 0, 'R');
                     $this->Ln(5);
                 }
                 $_subtotal = 0;
                 $_subtotalLast = 0;
                 if ($this->GetY() >= 250) {
                     $this->AddPage();
                     $this->myheader($periode_date, $report_id);
                 }
             }
             $this->SetFont('Arial', 'B', 8);
             if ($mmm->id == 2) {
                 $this->Cell(5, 4, '');
             }
             $this->Cell($w[0], 4, 'TOTAL ' . $model2->account_name);
             $this->SetX($this->x0 + 20);
             $this->Cell($w[1], 4, number_format($_grandtotal, 0, ',', '.'), 0, 0, 'R');
             $this->Cell($w[1] + 20, 4, number_format($_grandtotalLast, 0, ',', '.'), 0, 0, 'R');
             $this->Cell($w[1], 4, '');
             $this->Ln(8);
             if ($mmm->id == 3) {
                 //income
                 $_grandtotalI = $_grandtotal;
                 $_grandtotalILast = $_grandtotalLast;
             } elseif ($mmm->id == 4) {
                 //HPP
                 $_grandtotalH = $_grandtotal;
                 $_grossprofit = $_grandtotalI - $_grandtotalH;
                 $_grandtotalHLast = $_grandtotalLast;
                 $_grossprofitLast = $_grandtotalILast - $_grandtotalHLast;
             } else {
                 //Expenses
                 $_grandtotalE = $_grandtotal;
                 $_netprofit = $_grossprofit - $_grandtotalE;
                 $_grandtotalELast = $_grandtotalLast;
                 $_netprofitLast = $_grossprofitLast - $_grandtotalELast;
             }
             $_grandtotal = 0;
             $_grandtotalLast = 0;
         }
         if ($mmm->id == 4) {
             //GROSS PROFIT
             //$_s=$_s+3;
             $this->SetFont('Arial', 'B', 8);
             $this->Cell(array_sum($w), 4, 'GROSS PROFIT', 'T');
             $this->SetX($this->x0 + 20);
             $this->Cell($w[1], 4, number_format($_grossprofit, 0, ',', '.'), 'T', 0, 'R');
             $this->Cell($w[1], 4, '');
             $this->Cell($w[1], 4, number_format($_grossprofitLast, 0, ',', '.'), 'T', 0, 'R');
             $this->Ln(8);
         }
     }
     $_s = $_s + 3;
     $this->SetFont('Arial', 'B', 8);
     $this->Cell(array_sum($w), 4, 'INCOME OPERATION', 'T');
     $this->SetX($this->x0 + 20);
     $this->Cell($w[1], 4, number_format($_netprofit, 0, ',', '.'), 'T', 0, 'R');
     $this->Cell($w[1] + 20, 4, number_format($_netprofitLast, 0, ',', '.'), 'T', 0, 'R');
     $this->Ln(8);
     //Other Income and Other Expenses
     $model1 = tAccountMain::model()->with('account_list')->findAll('type_id= 3');
     $_grandtotalOI = 0;
     $_grandtotalOE = 0;
     $_netprofitFinal = 0;
     $_grandtotalOILast = 0;
     $_grandtotalOELast = 0;
     $_netprofitFinalLast = 0;
     foreach ($model1 as $mmm) {
         foreach ($mmm->account_list as $mm) {
             $model2 = tAccount::model()->findByPk((int) $mm->parent_id);
             $this->SetFont('Arial', 'B', 8);
             if ($mmm->id == 2) {
                 $this->Cell(5, 4, '');
             }
             $this->Cell($w[0], 4, $model2->account_concat());
             $this->SetX($this->x0);
             $this->Cell($w[1], 4, '');
             $this->Ln();
             foreach ($model2->childs as $model) {
                 if ($model->childs) {
                     $this->SetFont('Arial', 'B', 8);
                 } else {
                     $this->SetFont('Arial', '', 8);
                 }
                 $this->Cell($_s, 4, '');
                 $this->Cell($w[0], 4, $model->account_concat());
                 $this->SetX($this->x0);
                 $_model = $model->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                 $_periode_date_last = sParameter::cBeginDateBefore($periode_date);
                 $_modelLast = $model->balancesheet(array('condition' => 'yearmonth_periode =' . $_periode_date_last));
                 if (isset($_model->end_balance)) {
                     $_balance = number_format($_model->end_balance, 0, ',', '.');
                     $_mmodelLast = isset($_modelLast->end_balance) ? $_modelLast->end_balance : 0;
                     $_balanceLast = number_format($_mmodelLast, 0, ',', '.');
                     $_subtotal = $_subtotal + $_model->end_balance;
                     $_grandtotal = $_grandtotal + $_model->end_balance;
                     $_subtotalLast = $_subtotalLast + $_mmodelLast;
                     $_grandtotalLast = $_grandtotalLast + $_mmodelLast;
                 } else {
                     $_balance = 0;
                     $_balanceLast = 0;
                 }
                 if ($model->childs) {
                     $this->Cell($w[1], 4, '', 0, 0, 'R');
                 } else {
                     $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                     $this->Cell($w[1] + 20, 4, $_balanceLast, 0, 0, 'R');
                 }
                 $this->Ln();
                 if ($model->childs) {
                     foreach ($model->childs as $mod) {
                         if ($mod->childs) {
                             $this->SetFont('Arial', 'B', 8);
                         } else {
                             $this->SetFont('Arial', '', 8);
                         }
                         $this->Cell($_s + 3, 4, '');
                         $this->Cell($w[0], 4, $mod->account_concat());
                         $this->SetX($this->x0);
                         $_mod = $mod->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                         $_modLast = $mod->balancesheet(array('condition' => 'yearmonth_periode =' . $_periode_date_last));
                         $_mmodLast = isset($_modLast->end_balance) ? $_modLast->end_balance : 0;
                         if (isset($_mod->end_balance)) {
                             if ($mod->reverse) {
                                 $_balanceR = -$_mod->end_balance;
                                 $_balanceRLast = -$_mmodLast;
                             } else {
                                 $_balanceR = $_mod->end_balance;
                                 $_balanceRLast = $_mmodLast;
                             }
                             $_balance = number_format($_balanceR, 0, ',', '.');
                             $_subtotal = $_subtotal + $_balanceR;
                             $_grandtotal = $_grandtotal + $_balanceR;
                             $_balanceLast = number_format($_balanceRLast, 0, ',', '.');
                             $_subtotalLast = $_subtotalLast + $_balanceRLast;
                             $_grandtotalLast = $_grandtotalLast + $_balanceRLast;
                         } else {
                             $_balance = 0;
                             $_balanceLast = 0;
                         }
                         if ($mod->childs) {
                             $this->Cell($w[1], 4, '', 0, 0, 'R');
                         } else {
                             $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                             $this->Cell($w[1] + 20, 4, $_balanceLast, 0, 0, 'R');
                         }
                         $this->Ln();
                         if ($mod->childs) {
                             foreach ($mod->childs as $m) {
                                 $this->SetFont('Arial', '', 8);
                                 $this->Cell($_s + 10, 4, '');
                                 $this->Cell($w[0], 4, $m->account_concat());
                                 $this->SetX($this->x0);
                                 $_m = $m->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                                 $_mLast = $m->balancesheet(array('condition' => 'yearmonth_periode =' . $_periode_date_last));
                                 $_mmLast = isset($_mLast->end_balance) ? $_mLast->end_balance : 0;
                                 if (isset($_m->end_balance)) {
                                     if ($mod->reverse) {
                                         $_balanceR = -$_m->end_balance;
                                         $_balanceRLast = -$_mmLast;
                                     } else {
                                         $_balanceR = $_m->end_balance;
                                         $_balanceRLast = $_mmLast;
                                     }
                                     $_balance = number_format($_balanceR, 0, ',', '.');
                                     $_total = $_total + $_balanceR;
                                     $_subtotal = $_subtotal + $_balanceR;
                                     $_grandtotal = $_grandtotal + $_balanceR;
                                     $_balanceLast = number_format($_balanceRLast, 0, ',', '.');
                                     $_totalLast = $_totalLast + $_balanceRLast;
                                     $_subtotalLast = $_subtotalLast + $_balanceRLast;
                                     $_grandtotalLast = $_grandtotalLast + $_balanceRLast;
                                 } else {
                                     $_balance = 0;
                                     $_balanceLast = 0;
                                 }
                                 if ($m->childs) {
                                     $this->Cell($w[1], 4, '', 0, 0, 'R');
                                 } else {
                                     $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                                     $this->Cell($w[1], 4, $_balanceLast, 0, 0, 'R');
                                 }
                                 $this->Ln();
                             }
                         }
                         if ($mod->childs) {
                             $this->SetFont('Arial', 'B', 8);
                             $this->Cell($_s + 3, 4, '');
                             $this->Cell($w[0], 4, 'TOTAL ' . $mod->account_name);
                             $this->SetX($this->x0);
                             $this->Cell($w[1], 4, number_format($_total, 0, ',', '.'), 'T', 0, 'R');
                             $this->Cell($w[1], 4, '', 0);
                             $this->Cell($w[1], 4, number_format($_totalLast, 0, ',', '.'), 'T', 0, 'R');
                             $this->Ln(5);
                             $_total = 0;
                         }
                     }
                 }
                 if ($model->childs && $model->childsCount >= 2) {
                     $this->SetFont('Arial', 'B', 8);
                     $this->Cell($_s, 4, '');
                     $this->Cell($w[0], 4, 'TOTAL ' . $model->account_name);
                     $this->SetX($this->x0);
                     $this->Cell($w[1], 4, number_format($_subtotal, 0, ',', '.'), 'T', 0, 'R');
                     $this->Cell($w[1], 4, '', 0);
                     $this->Cell($w[1], 4, number_format($_subtotalLast, 0, ',', '.'), 'T', 0, 'R');
                     $this->Ln(5);
                 }
                 if ($_grandtotalOI == 0) {
                     //other Income
                     $_grandtotalOI = $_subtotal;
                     $_grandtotalOILast = $_subtotalLast;
                 } else {
                     //Expenses
                     $_grandtotalOE = $_subtotal;
                     $_grandtotalOELast = $_subtotalLast;
                 }
                 $_subtotal = 0;
                 $_subtotalLast = 0;
             }
             $this->SetFont('Arial', 'B', 8);
             if ($mmm->id == 2) {
                 $this->Cell(5, 4, '');
             }
             $this->Cell($w[0], 4, 'TOTAL ' . $model2->account_name);
             $this->SetX($this->x0 + 20);
             $this->Cell($w[1], 4, number_format($_grandtotal, 0, ',', '.'), 0, 0, 'R');
             $this->Cell($w[1], 4, '');
             $this->Cell($w[1], 4, number_format($_grandtotalLast, 0, ',', '.'), 0, 0, 'R');
             $this->Ln(8);
             $_grandtotalOIE = $_grandtotal;
             $_grandtotal = 0;
             $_grandtotalOIELast = $_grandtotalLast;
             $_grandtotalLast = 0;
         }
         $_netprofitFinal = $_netprofit + $_grandtotalOIE;
         $_netprofitFinalLast = $_netprofitLast + $_grandtotalOIELast;
         //$_s=$_s+3;
         $this->SetFont('Arial', 'B', 8);
         $this->Cell(array_sum($w), 4, 'NET INCOME', 'T');
         $this->SetX($this->x0 + 20);
         $this->Cell($w[1], 4, number_format($_netprofitFinal, 0, ',', '.'), 'T', 0, 'R');
         $this->Cell($w[1], 4, '');
         $this->Cell($w[1], 4, number_format($_netprofitFinalLast, 0, ',', '.'), 'T', 0, 'R');
         $this->Ln(8);
     }
 }
	<li class="nav-header">Cash and Bank</li>
</ul>
<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => uJournal::getTopUpdated(2), 'htmlOptions' => array('style' => 'font-size:12px; ')));
?>
<br />

<ul class="nav nav-list">
	<li class="nav-header">PO (Unapproved)</li>
</ul>
<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => vPorder::getTopUnApprovedPO(), 'htmlOptions' => array('style' => 'font-size:12px; ')));
?>
<br />

<ul class="nav nav-list">
	<li class="nav-header">PO (Unpaid)</li>
</ul>
<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => vPorder::getTopUnPaidPO(), 'htmlOptions' => array('style' => 'font-size:12px; ')));
?>
<br />

<ul class="nav nav-list">
	<li class="nav-header">Chart Of Account</li>
</ul>
<?php 
$this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => tAccount::getTopUpdated(), 'htmlOptions' => array('style' => 'font-size:12px; ')));
?>
<br />
    ?>
			</td>
			<td><?php 
    echo CHtml::textField('amount[]', '', array('maxlength' => 15));
    ?>
			</td>
		</tr>
		<?php 
} else {
    ?>
		<?php 
    for ($i = 0; $i < sizeof($model->budget_id); ++$i) {
        ?>
		<tr>
			<td><?php 
        echo CHtml::dropDownList('budget_id[]', $model->budget_id[$i], tAccount::item());
        ?>
			</td>
			<td><?php 
        echo CHtml::textField('description[]', $model->description[$i], array());
        ?>
			</td>
			<td><?php 
        echo CHtml::textField('qty[]', $model->qty[$i], array('maxlength' => 15));
        ?>
			</td>
			<td><?php 
        echo CHtml::textField('amount[]', $model->amount[$i], array('maxlength' => 15));
        ?>
			</td>
		</tr>
Ejemplo n.º 16
0
?>

<?php 
echo $form->dropDownListRow($model, 'haschild_id', sParameter::items("cHasChild"), array('disabled' => !empty($model->hasJournal), 'hint' => 'Dropdown will disabled automatically when this account already has journal voucher on current period'));
echo $form->textFieldRow($model, 'account_no', array('class' => 'span3'));
echo $form->textFieldRow($model, 'account_name', array('class' => 'span3'));
echo $form->textAreaRow($model, 'short_description', array('class' => 'span5', 'rows' => 3));
//echo $form->dropDownListRow($model,'currency_id',sParameter::items("cCurrency","*inherited*"));
//echo $form->dropDownListRow($model,'state_id',sParameter::items("cStatus","*inherited*"));
?>

<?php 
$this->widget('ext.appendo.JAppendo', array('id' => 'repeateEnum', 'model' => $model, 'viewName' => '_accountProperties', 'labelDel' => 'Remove Row'));
?>

<div class="form-actions">
	<?php 
echo CHtml::htmlButton('<i class="icon-ok"></i>' . $model->isNewRecord ? 'Create' : 'Save', array('class' => 'btn', 'type' => 'submit'));
?>
</div>

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

<hr />

<h3>Sibling Account</h3>
<?php 
$this->widget('bootstrap.widgets.BootGridView', array('id' => 't-account-grid', 'dataProvider' => tAccount::model()->searchSibling($model->parent_id, $model->id), 'itemsCssClass' => 'table table-striped table-bordered', 'template' => '{items}{pager}', 'columns' => array(array('name' => 'account_no', 'type' => 'raw', 'value' => 'CHtml::link($data->account_no. ". ".$data->account_name,Yii::app()->createUrl("tAccount/view",array("id"=>$data->id)))'), array('name' => 'haschild_id', 'value' => 'isset($data->haschild) ? $data->haschild->childName->name : "Not Set"'), array('header' => 'Type Account', 'value' => '$data->getRoot()'), array('header' => 'Currency', 'value' => '$data->getCurrency()'), array('header' => 'Status', 'value' => '$data->getState()'))));
Ejemplo n.º 17
0
?>


<div class="control-group">
	<?php 
echo $form->labelEx($model, 'payment_date', array('class' => 'control-label'));
?>
	<div class="controls">
		<?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'value' => CTimestamp::formatDate('yyyy-MM-dd', $model->payment_date), 'attribute' => 'payment_date', 'options' => array('showAnim' => 'fold', 'dateFormat' => 'dd-mm-yy', 'minDate' => '-20', 'maxDate' => '+1M +10D'), 'htmlOptions' => array()));
?>
	</div>
</div>

<?php 
echo $form->dropDownListRow($model, 'payment_source_id', tAccount::cashbankAccount());
?>

<?php 
echo $form->dropDownListRow($model, 'payment_type_id', array('1' => 'Cash', '2' => 'Cheque/Giro'));
?>

<?php 
echo $form->textAreaRow($model, 'description', array('rows' => 2, 'class' => 'span5'));
?>

<?php 
echo $form->textFieldRow($model, 'amount', array('class' => 'span3'));
?>

<div class="control-group">
 public function actionJournalPayment()
 {
     if (isset($_POST['journal_id'])) {
         $total = 0;
         $m_ref = array();
         foreach ($_POST['journal_id'] as $a => $val) {
             $model = vPorder::model()->findByPk((int) $val);
             $total = $total + $model->sum_po;
             $m_ref[] = $model->system_ref;
             if ($model->journal_state_id == 3) {
                 Yii::app()->user->setFlash("error", "<strong>Error!</strong> This PO already journalled...");
                 $this->redirect(array('/m2/mAccpayable', 'id' => 3));
             } else {
                 vPorder::model()->updateByPk((int) $val, array('journal_state_id' => 3));
             }
         }
         $modelHeader = new uJournal();
         $modelHeader->input_date = Yii::app()->dateFormatter->format("dd-MM-yyyy", time());
         $modelHeader->yearmonth_periode = Yii::app()->settings->get("System", "cCurrentPeriod");
         $modelHeader->remark = implode($m_ref, " ");
         $modelHeader->entity_id = sUser::model()->getGroup();
         //default group
         $modelHeader->module_id = 3;
         //AP
         $modelHeader->journal_type_id = 2;
         //Payment
         $modelHeader->state_id = 1;
         $modelHeader->created_by = Yii::app()->user->id;
         $modelHeader->created_date = time();
         $modelHeader->save();
         //Create System_ref
         $_ref = "AP-" . $modelHeader->yearmonth_periode . "-" . str_pad($modelHeader->id, 5, "0", STR_PAD_LEFT);
         $modelHeader->updateByPk((int) $modelHeader->id, array('system_ref' => $_ref));
         $modelDetail = new uJournalDetail();
         $modelDetail->parent_id = $modelHeader->id;
         $_inventory = tAccount::model()->with('hutang')->find('hutang.mvalue=1')->id;
         $modelDetail->account_no_id = $_inventory;
         $modelDetail->debit = $total;
         $modelDetail->credit = 0;
         $modelDetail->user_remark = implode($m_ref, " ");
         $modelDetail->save();
         $modelPayment = vPorderPayment::model()->findAll('parent_id = ' . $model->id);
         foreach ($modelPayment as $payment) {
             $modelDetail = new uJournalDetail();
             $modelDetail->parent_id = $modelHeader->id;
             $modelDetail->account_no_id = $payment->payment_source_id;
             $modelDetail->debit = 0;
             $modelDetail->credit = $payment->amount;
             $modelDetail->user_remark = implode($m_ref, " ");
             $modelDetail->save();
         }
         //in case ada selisih
         if ($payment->amount != $total) {
             $modelDetail = new uJournalDetail();
             $modelDetail->parent_id = $modelHeader->id;
             $_inventory = tAccount::model()->with('hutang')->find('hutang.mvalue=1')->id;
             $modelDetail->account_no_id = $_inventory;
             $modelDetail->debit = $payment->amount - $total;
             $modelDetail->credit = 0;
             $modelDetail->user_remark = 'Correction: ' . implode($m_ref, " ");
             $modelDetail->save();
         }
         Yii::app()->user->setFlash("success", "<strong>Great!</strong> Payment Journal created succesfully...");
         $this->render('viewJournal', array('model' => $modelHeader));
     } else {
         $this->redirect(array('/m2/mAccpayable'));
     }
 }
Ejemplo n.º 19
0
 public function netprofit($periode_date)
 {
     $model1 = tAccountMain::model()->with('account_list')->findAll('type_id= 2');
     $_s = 5;
     //Reset
     $_total = 0;
     $_subtotal = 0;
     $_grandtotal = 0;
     $_grandtotalI = 0;
     $_grandtotalH = 0;
     $_grandtotalE = 0;
     foreach ($model1 as $mmm) {
         foreach ($mmm->account_list as $mm) {
             $model2 = tAccount::model()->findByPk((int) $mm->parent_id);
             foreach ($model2->childs as $model) {
                 $_model = $model->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                 if (isset($_model->end_balance)) {
                     $_balance = number_format($_model->end_balance, 0, ',', '.');
                     $_subtotal = $_subtotal + $_model->end_balance;
                     $_grandtotal = $_grandtotal + $_model->end_balance;
                 } else {
                     $_balance = 0;
                 }
                 if ($model->childs) {
                     foreach ($model->childs as $mod) {
                         $_mod = $mod->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                         if (isset($_mod->end_balance)) {
                             $_balance = number_format($_mod->end_balance, 0, ',', '.');
                             $_subtotal = $_subtotal + $_mod->end_balance;
                             $_grandtotal = $_grandtotal + $_mod->end_balance;
                         } else {
                             $_balance = 0;
                         }
                         if ($mod->childs) {
                             foreach ($mod->childs as $m) {
                                 $_m = $m->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                                 if (isset($_m->end_balance)) {
                                     $_balance = number_format($_m->end_balance, 0, ',', '.');
                                     $_total = $_total + $_m->end_balance;
                                     $_subtotal = $_subtotal + $_m->end_balance;
                                     $_grandtotal = $_grandtotal + $_m->end_balance;
                                 } else {
                                     $_balance = 0;
                                 }
                             }
                         }
                         if ($mod->childs) {
                             $_total = 0;
                         }
                     }
                 }
                 $_subtotal = 0;
             }
             if ($mmm->id == 3) {
                 //income
                 $_grandtotalI = $_grandtotal;
             } elseif ($mmm->id == 4) {
                 //HPP
                 $_grandtotalH = $_grandtotal;
                 $_grossprofit = $_grandtotalI - $_grandtotalH;
             } else {
                 //Expenses
                 $_grandtotalE = $_grandtotal;
                 $_netprofit = $_grossprofit - $_grandtotalE;
             }
             $_grandtotal = 0;
         }
     }
     //Other Income and Other Expenses
     $model1 = tAccountMain::model()->with('account_list')->findAll('type_id= 3');
     $_grandtotalOI = 0;
     $_grandtotalOE = 0;
     $_netprofitFinal = 0;
     foreach ($model1 as $mmm) {
         foreach ($mmm->account_list as $mm) {
             $model2 = tAccount::model()->findByPk((int) $mm->parent_id);
             foreach ($model2->childs as $model) {
                 $_model = $model->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                 if (isset($_model->end_balance)) {
                     $_balance = number_format($_model->end_balance, 0, ',', '.');
                     $_subtotal = $_subtotal + $_model->end_balance;
                     $_grandtotal = $_grandtotal + $_model->end_balance;
                 } else {
                     $_balance = 0;
                 }
                 if ($model->childs) {
                     foreach ($model->childs as $mod) {
                         $_mod = $mod->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                         if (isset($_mod->end_balance)) {
                             if ($mod->reverse) {
                                 $_balanceR = -$_mod->end_balance;
                             } else {
                                 $_balanceR = $_mod->end_balance;
                             }
                             $_balance = number_format($_balanceR, 0, ',', '.');
                             $_subtotal = $_subtotal + $_balanceR;
                             $_grandtotal = $_grandtotal + $_balanceR;
                         } else {
                             $_balance = 0;
                         }
                         if ($mod->childs) {
                             foreach ($mod->childs as $m) {
                                 $_m = $m->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                                 if (isset($_m->end_balance)) {
                                     if ($mod->reverse) {
                                         $_balanceR = -$_m->end_balance;
                                     } else {
                                         $_balanceR = $_m->end_balance;
                                     }
                                     $_balance = number_format($_balanceR, 0, ',', '.');
                                     $_total = $_total + $_balanceR;
                                     $_subtotal = $_subtotal + $_balanceR;
                                     $_grandtotal = $_grandtotal + $_balanceR;
                                 } else {
                                     $_balance = 0;
                                 }
                             }
                         }
                         if ($mod->childs) {
                             $_total = 0;
                         }
                     }
                 }
                 if ($_grandtotalOI == 0) {
                     //other Income
                     $_grandtotalOI = $_subtotal;
                 } else {
                     //Expenses
                     $_grandtotalOE = $_subtotal;
                 }
                 $_subtotal = 0;
             }
             $_grandtotalOIE = $_grandtotal;
             $_grandtotal = 0;
         }
         $_netprofitFinal = $_netprofit + $_grandtotalOIE;
     }
     return $_netprofitFinal;
 }
Ejemplo n.º 20
0
<?php

if (isset($model->getparent->getparent->getparent->account_name)) {
    $this->breadcrumbs = array($model->getparent->getparent->getparent->account_name => array('view', 'id' => $model->getparent->getparent->getparent->id), $model->getparent->getparent->account_name => array('view', 'id' => $model->getparent->getparent->id), $model->getparent->account_name => array('view', 'id' => $model->getparent->id), $model->account_name);
} elseif (isset($model->getparent->getparent->account_name)) {
    $this->breadcrumbs = array($model->getparent->getparent->account_name => array('view', 'id' => $model->getparent->getparent->id), $model->getparent->account_name => array('view', 'id' => $model->getparent->id), $model->account_name);
} elseif (isset($model->getparent->account_name)) {
    $this->breadcrumbs = array($model->getparent->account_name => array('view', 'id' => $model->getparent->id), $model->account_name);
} else {
    $this->breadcrumbs = array($model->account_name);
}
$this->menu = array(array('label' => 'Home', 'icon' => 'home', 'url' => array('/m2/tAccount')), array('label' => 'Update', 'icon' => 'edit', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete', 'icon' => 'remove', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?'), 'visible' => empty($model->hasJournal)));
$this->menu1 = tAccount::getTopUpdated();
$this->menu2 = tAccount::getTopCreated();
$this->menu3 = tAccount::getTopRelated($model->account_name);
?>

<div class="page-header">
	<h1>
		<?php 
echo CHtml::image(Yii::app()->request->baseUrl . '/images/icon/tree_diagramm_new.png');
?>
		<?php 
echo $model->account_no . ". " . $model->account_name;
?>
	</h1>
</div>

<?php 
if ($model->haschild->mvalue == 2) {
    $this->widget('bootstrap.widgets.BootTabbable', array('type' => 'tabs', 'tabs' => array(array('label' => 'Detail', 'content' => $this->renderPartial("_tabDetail", array("model" => $model, "modelAccount" => $modelAccount), true), 'active' => true), array('label' => 'Entity', 'content' => $this->renderPartial("_tabEntity", array("model" => $model, 'modelEntity' => $modelEntity), true)), array('label' => 'Sub Account', 'content' => $this->renderPartial("_tabSub", array("model" => $model), true)), array('label' => 'Linked Module', 'content' => $this->renderPartial("_tabModule", array("model" => $model), true)))));
<?php

$result = tAccount::model()->findAll();
$_oldvalue = 0;
$_val = 0;
echo '<ul>';
foreach ($result as $row) {
    if ($row->parent_id == $_oldvalue) {
        $_val = $_val + 1;
        echo '<li>' . $_val . " " . $row->account_name . '</li>';
    } else {
        $_val = $_val - 1;
        echo '<li>' . $_val . " " . $row->account_name . '</li>';
    }
    $_oldvalue = $row->id;
}
echo '</ul>';
Ejemplo n.º 22
0
<?php

$this->breadcrumbs = array('Chart of Accounts');
$this->menu = array(array('label' => 'Home', 'url' => array('/tAccount')), array('label' => 'Create New Root Account', 'url' => array('create')), array('label' => 'Print List', 'url' => array('printList')));
$this->menu1 = tAccount::getTopUpdated();
//$this->menu2=tAccount::getTopCreated();
?>

<div class="pull-right">
	<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div>

<div class="page-header">
		<h1><?php 
echo CHtml::image(Yii::app()->request->baseUrl . '/images/icon/tree_diagramm_new.png');
?>
	Chart of Accounts</h1>
</div>

<?php 
//$this->widget('zii.widgets.CListView', array(
//$this->widget('ext.bootstrap.widgets.BootListView', array(
//		'dataProvider'=>$dataProvider,
//		'itemView'=>'_view',
//));
?>

<?php 
//$this->renderPartial('_view',array(
 function report($periode_date, $report_id)
 {
     $this->myheader($periode_date, $report_id);
     $w = array(130, 20);
     $model1 = tAccountMain::model()->with('account_list')->findAll('type_id = 1');
     $_labarugi = tAccount::labarugiDitahan($periode_date);
     $_s = 5;
     //Reset
     $_total = 0;
     $_subtotal = 0;
     $_grandtotal = 0;
     $_grandtotalA = 0;
     $_grandtotalP = 0;
     //Print/Preview Report
     foreach ($model1 as $mmm) {
         if ($mmm->id == 2) {
             //pasiva
             $_s = $_s + 5;
             $this->SetFont('Arial', 'B', 8);
             $this->Cell($w[0], 4, $mmm->name);
             $this->Cell($w[1], 4, '');
             $this->Ln();
         }
         foreach ($mmm->account_list as $mm) {
             $model2 = tAccount::model()->findByPk((int) $mm->parent_id);
             $this->SetFont('Arial', 'B', 8);
             if ($mmm->id == 2) {
                 $this->Cell(5, 4, '');
             }
             $this->Cell($w[0], 4, $model2->account_concat());
             $this->SetX($this->x0);
             $this->Cell($w[1], 4, '');
             $this->Ln();
             foreach ($model2->childs as $model) {
                 $this->SetFont('Arial', 'B', 8);
                 $this->Cell($_s, 4, '');
                 $this->Cell($w[0], 4, $model->account_concat());
                 $this->SetX($this->x0);
                 $this->Cell($w[1], 4, '');
                 $this->Ln();
                 if ($model->childs) {
                     foreach ($model->childs as $mod) {
                         if ($mod->childs) {
                             $this->SetFont('Arial', 'B', 8);
                         } else {
                             $this->SetFont('Arial', '', 8);
                         }
                         $this->Cell($_s + 5, 4, '');
                         $this->Cell($w[0], 4, $mod->account_concat());
                         $this->SetX($this->x0);
                         $_mod = $mod->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                         if (isset($_mod->end_balance)) {
                             $_balance = number_format($_mod->end_balance, 0, ',', '.');
                             $_subtotal = $_subtotal + $_mod->end_balance;
                             $_grandtotal = $_grandtotal + $_mod->end_balance;
                         } else {
                             $_balance = 0;
                         }
                         if ($mod->childs) {
                             $this->Cell($w[1], 4, '', 0, 0, 'R');
                         } else {
                             /* if (isset($mod->accmain) && $mod->accmain->mvalue ==8) {
                             				$this->Cell($w[1],4,number_format($_labarugi,0,',','.'),0,0,'R');
                             			$_total=$_total+$_labarugi;
                             			$_subtotal=$_subtotal+$_labarugi;
                             			$_grandtotal=$_grandtotal+$_labarugi;
                             			} else */
                             $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                         }
                         $this->Ln();
                         if ($mod->childs) {
                             foreach ($mod->childs as $m) {
                                 if ($m->childs) {
                                     $this->SetFont('Arial', 'B', 8);
                                 } else {
                                     $this->SetFont('Arial', '', 8);
                                 }
                                 $this->Cell($_s + 10, 4, '');
                                 $this->Cell($w[0], 4, $m->account_concat());
                                 $this->SetX($this->x0);
                                 $_m = $m->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                                 if (isset($_m->end_balance)) {
                                     $_balance = number_format($_m->end_balance, 0, ',', '.');
                                     $_total = $_total + $_m->end_balance;
                                     $_subtotal = $_subtotal + $_m->end_balance;
                                     $_grandtotal = $_grandtotal + $_m->end_balance;
                                 } else {
                                     $_balance = 0;
                                 }
                                 if ($m->childs) {
                                     $this->Cell($w[1], 4, '', 0, 0, 'R');
                                 } else {
                                     /* if (isset($m->accmain) && $m->accmain->mvalue ==8) {
                                     				$this->Cell($w[1],4,number_format($_labarugi,0,',','.'),0,0,'R');
                                     			$_total=$_total+$_labarugi;
                                     			$_subtotal=$_subtotal+$_labarugi;
                                     			$_grandtotal=$_grandtotal+$_labarugi;
                                     			} else */
                                     $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                                 }
                                 $this->Ln();
                                 if ($m->childs) {
                                     ////////////////LAST
                                     foreach ($m->childs as $n) {
                                         if ($n->childs) {
                                             $this->SetFont('Arial', 'B', 8);
                                         } else {
                                             $this->SetFont('Arial', '', 8);
                                         }
                                         $this->Cell($_s + 15, 4, '');
                                         $this->Cell($w[0], 4, $n->account_concat());
                                         $this->SetX($this->x0);
                                         $_n = $n->balancesheet(array('condition' => 'yearmonth_periode =' . $periode_date));
                                         if (isset($_n->end_balance)) {
                                             $_balance = number_format($_n->end_balance, 0, ',', '.');
                                             $_total = $_total + $_n->end_balance;
                                             $_subtotal = $_subtotal + $_n->end_balance;
                                             $_grandtotal = $_grandtotal + $_n->end_balance;
                                         } else {
                                             $_balance = 0;
                                         }
                                         if ($n->childs) {
                                             $this->Cell($w[1], 4, '', 0, 0, 'R');
                                         } else {
                                             /* if (isset($n->accmain) && $n->accmain->mvalue ==8) {
                                             				$this->Cell($w[1],4,number_format($_labarugi,0,',','.'),0,0,'R');
                                             			$_total=$_total+$_labarugi;
                                             			$_subtotal=$_subtotal+$_labarugi;
                                             			$_grandtotal=$_grandtotal+$_labarugi;
                                             			} else */
                                             $this->Cell($w[1], 4, $_balance, 0, 0, 'R');
                                         }
                                         $this->Ln();
                                     }
                                     ///LAST
                                 }
                             }
                         }
                         if ($mod->childs && $mod->childsCount >= 2) {
                             $this->SetFont('Arial', 'B', 8);
                             $this->Cell($_s + 5, 4, '');
                             $this->Cell($w[0], 4, 'TOTAL ' . $mod->account_name);
                             $this->SetX($this->x0);
                             $this->Cell($w[1], 4, number_format($_total, 0, ',', '.'), 'T', 0, 'R');
                             $this->Ln(5);
                         }
                         if ($mod->childs) {
                             $_total = 0;
                         }
                         if ($this->GetY() >= 250) {
                             $this->AddPage();
                             $this->myheader($periode_date, $report_id);
                         }
                     }
                 }
                 $this->SetFont('Arial', 'B', 8);
                 $this->Cell($_s, 4, '');
                 $this->Cell($w[0], 4, 'TOTAL ' . $model->account_name);
                 $this->SetX($this->x0 + 20);
                 $this->Cell($w[1], 4, number_format($_subtotal, 0, ',', '.'), 'T', 0, 'R');
                 $this->Ln(5);
                 $_subtotal = 0;
                 if ($this->GetY() >= 250) {
                     $this->AddPage();
                     $this->myheader();
                 }
             }
             $this->SetFillColor(224, 224, 224);
             $this->SetFont('Arial', 'B', 8);
             if ($mmm->id == 2) {
                 $this->Cell(5, 4, '');
             }
             $this->Cell($w[0], 4, 'TOTAL ' . $model2->account_name, 0, 0, 'L', true);
             $this->SetX($this->x0 + 20);
             $this->Cell($w[1], 4, number_format($_grandtotal, 0, ',', '.'), 0, 0, 'R', true);
             $this->Cell($w[1], 4, '');
             $this->Ln(8);
             if ($mmm->id == 1) {
                 //Aktiva
                 $_grandtotalA = $_grandtotal;
             } else {
                 $_grandtotalP = $_grandtotalP + $_grandtotal;
             }
             $_grandtotal = 0;
         }
         if ($mmm->id == 2) {
             //Pasiva
             $_s = $_s + 5;
             $this->SetFont('Arial', 'B', 8);
             $this->Cell($w[0], 4, $mmm->name, 0, 0, 'L', true);
             $this->SetX($this->x0 + 20);
             $this->Cell($w[1], 4, number_format($_grandtotalP, 0, ',', '.'), 0, 0, 'R', true);
             $this->Ln();
         }
     }
 }
Ejemplo n.º 24
0
	<?php 
echo $form->labelEx($model, 'input_date', array('class' => 'control-label'));
?>
	<div class="controls">
		<?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'id' => 'g2', 'value' => CTimestamp::formatDate('yyyy-MM-dd', $model->input_date), 'attribute' => 'input_date', 'options' => array('showAnim' => 'fold', 'dateFormat' => 'dd-mm-yy', 'minDate' => '-20', 'maxDate' => '+1M +10D'), 'htmlOptions' => array()));
?>
	</div>
</div>

<?php 
//echo $form->dropDownListRow($model,'yearmonth_periode',array(Yii::app()->settings->get("System", "cCurrentPeriod")=>Yii::app()->settings->get("System", "cCurrentPeriod")));
?>

<?php 
echo $form->dropDownListRow($model, 'var_account', tAccount::cashBankAccount());
echo $form->textFieldRow($model, 'cb_receiver', array('class' => 'span3'));
echo $form->textAreaRow($model, 'remark', array('class' => 'span5', 'rows' => 3));
?>

<?php 
$this->widget('ext.appendo.JAppendo', array('id' => 'repeateEnum1', 'model' => $model, 'viewName' => '_detailJournal', 'labelDel' => 'Remove Row'));
?>

<div class="form-actions">
	<?php 
echo CHtml::htmlButton('<i class="icon-ok"></i> Save Expense', array('class' => 'btn', 'type' => 'submit'));
?>
</div>

<?php 
Ejemplo n.º 25
0
		'options'=>array(
				'showAnim'=>'fold',
				'dateFormat'=>'yymm',
		),
		'htmlOptions'=>array(
				
		),
));
?>
</div>
</div>
*/
?>

<?php 
echo $form->dropDownListRow($model, 'budgetcomp_id', tAccount::purchasingAccount());
?>

<?php 
echo $form->dropDownListRow($model, 'supplier_id', cSupplier::items());
?>

<?php 
echo $form->textAreaRow($model, 'remark', array('rows' => 2, 'class' => 'span5'));
?>

<?php 
$this->widget('ext.appendo.JAppendo', array('id' => 'repeateEnum', 'model' => $model, 'viewName' => '_detailPorderGeneral', 'labelDel' => 'Remove Row'));
?>

<div class="form-actions">