コード例 #1
0
 public function actionClosingPeriodExecution()
 {
     uJournal::model()->updateAll(array('state_id' => 3, 'updated_date' => time(), 'updated_id' => Yii::app()->user->id), 'state_id !=4 AND yearmonth_periode = ' . Yii::app()->settings->get("System", "cCurrentPeriod"));
     $this->transferNewPeriod();
     $_nextPeriod = sParameter::cBeginDateAfter(Yii::app()->settings->get("System", "cCurrentPeriod"));
     Yii::app()->settings->set("System", "cCurrentPeriod", $_nextPeriod, $toDatabase = true);
 }
コード例 #2
0
 public function actionViewJournal($id)
 {
     //----- begin new code --------------------
     if (!empty($_GET['asDialog'])) {
         $this->layout = '//layouts/iframe';
     }
     //----- end new code --------------------
     $model = uJournal::model()->findByPk($id);
     $this->render('/uJournal/view', array('model' => $model));
 }
コード例 #3
0
 public function actionClosingPeriodExecution()
 {
     uJournal::model()->updateAll(array('state_id' => 3, 'updated_date' => time(), 'updated_by' => Yii::app()->user->id), 'state_id !=4 AND yearmonth_periode = ' . Yii::app()->settings->get("System", "cCurrentPeriod"));
     $_curPeriod = Yii::app()->settings->get("System", "cCurrentPeriod");
     $_nextPeriod = sParameter::cBeginDateAfter(Yii::app()->settings->get("System", "cCurrentPeriod"));
     $models = tBalanceSheet::model()->findAll('yearmonth_periode = ' . $_curPeriod);
     foreach ($models as $model) {
         if ($model->account->getTypeValue() == 1) {
             $sql = 'INSERT INTO t_balance_sheet (parent_id, yearmonth_periode, type_balance_id, remark, budget, beginning_balance,debit,credit,end_balance) VALUES (' . $model->parent_id . ',' . $_nextPeriod . ', 1, \'Automated posted\', 0,' . $model->end_balance . ',0,0,' . $model->end_balance . ')';
         } else {
             $sql = 'INSERT INTO t_balance_sheet (parent_id, yearmonth_periode, type_balance_id, remark, budget, beginning_balance,debit,credit,end_balance) VALUES (' . $model->parent_id . ',' . $_nextPeriod . ', 1, \'Automated posted\', 0,0,0,0,0)';
         }
         $command = Yii::app()->db->createCommand($sql);
         $command->execute();
         tBalanceSheet::model()->updateAll(array('type_balance_id' => 2), 'yearmonth_periode = ' . $_curPeriod);
     }
     $_nextPeriod = sParameter::cBeginDateAfter(Yii::app()->settings->get("System", "cCurrentPeriod"));
     Yii::app()->settings->set("System", "cCurrentPeriod", $_nextPeriod, $toDatabase = true);
     Yii::app()->user->setFlash('success', '<strong>Great!</strong> Closing Period has been successful...');
     $this->redirect(array('index'));
 }
コード例 #4
0
 function report($acc_id, $begin_date, $end_date)
 {
     $this->myHeader($acc_id, $begin_date, $end_date);
     $_count = 0;
     $_total = 0;
     $_counter = 1;
     $_countert = 1;
     $criteria = new CDbCriteria();
     $criteria->with = array('journalDetail');
     $criteria->compare('journalDetail.account_no_id', $acc_id);
     $criteria->addBetweenCondition('input_date', Yii::app()->dateFormatter->format('yyyy-MM-dd', $begin_date), Yii::app()->dateFormatter->format('yyyy-MM-dd', $end_date));
     $models = uJournal::model()->findAll($criteria);
     $_mdate = "";
     $_tdebet = 0;
     $_tcredit = 0;
     //Color and font restoration
     $this->SetFillColor(224, 224, 224);
     $this->SetTextColor(0);
     $this->SetFont('');
     //Data
     $fill = false;
     $w = array(7, 18, 14, 33, 18, 18, 70, 15);
     foreach ($models as $mod) {
         foreach ($mod->journalDetail as $mm) {
             $this->SetFont('Arial', '', 8);
             $this->Cell($w[0], 6, number_format($_countert, 0, ',', '.'), 'L', 0, 'R', $fill);
             if ($_mdate != $mod->input_date) {
                 $this->Cell($w[1], 6, $mod->input_date, 'LT', 0, 'L', $fill);
             } else {
                 $this->Cell($w[1], 6, '', 'L');
             }
             $_mdate = $mod->input_date;
             $this->Cell($w[2], 6, $mod->yearmonth_periode, 'L', 0, 'L', $fill);
             $this->Cell($w[3], 6, $mod->system_ref, 'L', 0, 'L', $fill);
             $this->Cell($w[4], 6, number_format($mm->debit, 0, ',', '.'), 'L', 0, 'R', $fill);
             $this->Cell($w[5], 6, number_format($mm->credit, 0, ',', '.'), 'L', 0, 'R', $fill);
             $this->Cell($w[6], 6, strlen($mod->remark) >= 40 ? substr($mod->remark, 0, 38) . " ... " : $mod->remark, 'L', 0, 'L', $fill);
             $this->Cell($w[7], 6, $mod->status->name, 'LR', 0, 'L', $fill);
             $this->Ln();
             $_tdebet = $_tdebet + $mm->debit;
             $_tcredit = $_tcredit + $mm->credit;
             $_counter++;
             $_countert++;
             if ($_counter == 34) {
                 $this->Cell(array_sum($w), 0, '', 'T');
                 $this->AddPage();
                 $this->myHeader($acc_id, $begin_date, $end_date);
                 $_counter = 1;
             }
             $fill = !$fill;
         }
     }
     //Closure line
     $this->Cell(array_sum($w), 0, '', 'T');
     $this->Ln(1);
     $this->SetFont('Arial', 'B', 8);
     $this->Cell($w[0], 8, '', 'TLB');
     $this->Cell($w[1], 8, 'T O T A L', 'TLB', 0, 'C');
     $this->Cell($w[2], 8, '', 'TLB');
     $this->Cell($w[3], 8, '', 'TLB');
     $this->Cell($w[4], 8, number_format($_tdebet, 0, ',', '.'), 'TLB', 0, 'R');
     $this->Cell($w[5], 8, number_format($_tcredit, 0, ',', '.'), 'TLB', 0, 'R');
     $this->Cell($w[6], 8, '', 'TLB');
     $this->Cell($w[7], 8, '', 'TLBR', 0, 'R');
     $this->Ln();
 }
コード例 #5
0
	</h2>
</div>
</div>

<div class="row-fluid">
<div class="span10 well">
	<p>When Button "Closing Month Period" executed, it will do this 3
		following steps.</p>
	<p>#1. It will check, of any unposted journal on Current Period, will
		marked as Locked</p>
	<p>#2. It will move each End-Balance Account on Current Month Period and
		transfer into following Month Period.</p>
	<p>#3. Change Current Period into following Month Period. When this
		process done, all existing journal become unavailable to edit and
		delete</p>
</div>
</div>

<p>
	<?php 
$this->widget('zii.widgets.jui.CJuiButton', array('buttonType' => 'link', 'id' => 'myCap', 'name' => 'btnGo7', 'url' => Yii::app()->createUrl("/m2/tClosing/closingPeriodExecution"), 'caption' => 'Closing Month Period', 'options' => array(), 'htmlOptions' => array('class' => 'ui-button-primary')));
?>
</p>


<h2>Unposted Journal</h2>
<?php 
//$this->widget('bootstrap.widgets.BootGridView', array(
$this->widget('ext.groupgridview.GroupGridView', array('mergeColumns' => array('input_date'), 'id' => 'u-journal-grid', 'dataProvider' => uJournal::model()->search(), 'itemsCssClass' => 'table table-striped table-bordered', 'template' => '{items}{pager}{summary}', 'columns' => array(array('class' => 'bootstrap.widgets.BootButtonColumn', 'template' => '{delete}', 'deleteButtonUrl' => 'Yii::app()->createUrl("/m2/tPosting/delete",array("id"=>$data->id))'), 'input_date', 'system_ref', array('header' => 'Module', 'value' => 'sParameter::item("cModule",$data->module_id)'), array('header' => 'Status', 'value' => '$data->status->name'), array('header' => 'Total', 'type' => 'number', 'value' => '$data->journalSum', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')))));
//$_nextPeriod = sParameter::cBeginDateAfter(Yii::app()->settings->get("System", "cCurrentPeriod"));
//Yii::app()->settings->set("System", "cCurrentPeriod", $_nextPeriod, $toDatabase=true);
コード例 #6
0
$this->widget('bootstrap.widgets.BootDetailView', array('data' => $model, 'attributes' => array('input_date', 'periode_date', 'system_ref', array('label' => 'Purchasing Type', 'value' => $model->po_type->name), array('label' => 'Entity', 'value' => $model->organization->name), array('label' => 'Supplier', 'value' => $model->supplier->company_name), 'remark', array('label' => 'Payment Status', 'value' => $model->paymentCheck()), array('label' => 'Journal Status', 'value' => $model->journal_state->name))));
?>

<br />

<?php 
$this->widget('bootstrap.widgets.BootGridView', array('id' => 'u-order-detail-grid', 'dataProvider' => bPorderDetail::model()->search($model->id), 'template' => '{items}{pager}', 'itemsCssClass' => 'table table-striped table-bordered', 'columns' => array(array('header' => 'Item.', 'value' => '$data->item_id'), 'description', 'qty', 'uom', array('value' => '$data->amountf()', 'name' => 'amount', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), array('header' => 'Total', 'value' => '$data->totalf()', 'name' => 'amount', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')))));
?>
<br />
<b> Total: <?php 
echo $model->sum_pof();
?>
</b>

<hr />

<h2>Purchased Journal</h2>
<?php 
$this->widget('bootstrap.widgets.BootDetailView', array('data' => uJournal::model()->searchTagPurchasing($model->system_ref), 'attributes' => array('input_date', 'yearmonth_periode', 'user_ref', 'system_ref', 'remark')));
echo $this->renderPartial('/uJournal/_viewDetail', array('id' => uJournal::model()->searchTagPurchasing($model->system_ref)->id));
?>

<?php 
if ($model->journal_state_id == 3) {
    ?>
<hr />
<h2>Payment Journal</h2>
<?php 
    $this->widget('bootstrap.widgets.BootDetailView', array('data' => uJournal::model()->searchTagPayment($model->system_ref), 'attributes' => array('input_date', 'yearmonth_periode', 'user_ref', 'system_ref', 'remark')));
    echo $this->renderPartial('/uJournal/_viewDetail', array('id' => uJournal::model()->searchTagPayment($model->system_ref)->id));
}
コード例 #7
0
<?php

$this->widget('bootstrap.widgets.BootGridView', array('id' => 'u-journal-detail-grid', 'dataProvider' => uJournalDetail::model()->search($id), 'template' => '{items}{pager}', 'itemsCssClass' => 'table table-striped table-bordered', 'columns' => array(array('name' => 'account_no_id', 'type' => 'raw', 'value' => 'CHtml::link($data->account->account_no.". ".$data->account->account_name,Yii::app()->createUrl("/m2/tAccount/view",array("id"=>$data->account->id)))'), array('class' => 'ext.gridcolumns.TotalColumn', 'name' => 'debit', 'output' => 'Yii::app()->indoFormat->number($value)', 'type' => 'raw', 'footer' => true, 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;'), 'footerHtmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), array('class' => 'ext.gridcolumns.TotalColumn', 'name' => 'credit', 'output' => 'Yii::app()->indoFormat->number($value)', 'type' => 'raw', 'footer' => true, 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;'), 'footerHtmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), 'user_remark')));
?>


<?php 
$this->widget('bootstrap.widgets.BootDetailView', array('data' => uJournal::model()->findByPk((int) $id), 'attributes' => array(array('label' => 'Total', 'value' => Yii::app()->indoFormat->number(uJournal::model()->findByPk((int) $id)->journalSum)), array('label' => 'Check', 'value' => 'WARNING!!! NOT BALANCE... CONTACT DEVELOPER', 'visible' => uJournal::model()->findByPk((int) $id)->journalSum != uJournal::model()->findByPk((int) $id)->journalSumCek))));
コード例 #8
0
 public function actionCreate()
 {
     $model = new fJournal();
     //$this->performAjaxValidation($model);
     //default value
     $_myDebit = 0;
     $_myCredit = 0;
     $model->balance = "NOT OK";
     if (isset($_POST['account_no_id'])) {
         $model->attributes = $_POST['fJournal'];
         $model->account_no_id = $_POST['account_no_id'];
         $model->debit = $_POST['debit'];
         $model->credit = $_POST['credit'];
         $model->user_remark = $_POST['user_remark'];
         foreach ($model->debit as $_debit) {
             $_myDebit = $_myDebit + $_debit;
         }
         foreach ($model->credit as $_credit) {
             $_myCredit = $_myCredit + $_credit;
         }
         if ($_myDebit == $_myCredit && $_myDebit != 0 && $_myCredit != 0) {
             $model->balance = "OK";
         } else {
             $model->balance = "NOT OK";
         }
         if ($model->validate()) {
             $modelHeader = new uJournal();
             $modelHeader->input_date = $_POST['fJournal']['input_date'];
             $modelHeader->yearmonth_periode = Yii::app()->settings->get("System", "cCurrentPeriod");
             $modelHeader->remark = $_POST['fJournal']['remark'];
             $modelHeader->entity_id = 1;
             $modelHeader->module_id = 1;
             //GL
             $modelHeader->state_id = 1;
             $modelHeader->journal_type_id = 1;
             $modelHeader->save();
             for ($i = 0; $i < sizeof($model->account_no_id); ++$i) {
                 $modelDetail = new uJournalDetail();
                 $modelDetail->parent_id = $modelHeader->id;
                 $modelDetail->account_no_id = $model->account_no_id[$i];
                 if ($model->debit[$i] != null) {
                     $modelDetail->debit = $model->debit[$i];
                 } else {
                     $modelDetail->debit = 0;
                 }
                 if ($model->credit[$i] != null) {
                     $modelDetail->credit = $model->credit[$i];
                 } else {
                     $modelDetail->credit = 0;
                 }
                 $modelDetail->user_remark = $model->user_remark[$i];
                 $modelDetail->sub_account_id = 0;
                 $modelDetail->save();
             }
             //Create System_ref
             $_ref = "GL-" . $modelHeader->yearmonth_periode . "-" . str_pad($modelHeader->id, 5, "0", STR_PAD_LEFT);
             $modelHeader->updateByPk((int) $modelHeader->id, array('system_ref' => $_ref));
             Yii::app()->user->setFlash("success", "<strong>Great!</strong> Journal created succesfully...");
             $this->redirect(array('/m2/uJournal'));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #9
0
 function report($id)
 {
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 8, 'JOURNAL VOUCHER', '', 0, 'C');
     $this->Ln(8);
     $model = uJournal::model()->findByPk((int) $id);
     //Header
     $this->SetFont('Arial', '', 10);
     $this->Cell(25, 4, 'Voucher No.');
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(50, 4, ': ' . $model->system_ref);
     $this->Ln();
     $this->SetFont('Arial', '', 10);
     $this->Cell(25, 4, 'Date');
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(60, 4, ': ' . $model->input_date);
     $this->Ln();
     $this->SetFont('Arial', '', 10);
     $this->Cell(25, 4, 'Periode');
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(60, 4, ': ' . $model->yearmonth_periode);
     $this->Ln(4);
     $this->SetFont('Arial', '', 10);
     $this->Cell(25, 4, 'Description');
     $this->Cell(60, 4, ': ' . $model->remark);
     $this->Ln(6);
     $w = array(70, 25, 25, 70);
     //Header
     $this->SetFont('Arial', 'B', 10);
     $this->Cell($w[0], 9, 'Account Name', 'LTBR', 0, 'C');
     $this->Cell($w[1], 9, 'Debit', 'TBR', 0, 'C');
     $this->Cell($w[2], 9, 'Credit', 'TBR', 0, 'C');
     $this->Cell($w[3], 9, 'Remark', 'TBR', 0, 'C');
     $this->Ln();
     $modelD = uJournalDetail::model()->findAll('parent_id = ' . (int) $id);
     //Detail
     foreach ($modelD as $mod) {
         $this->SetFont('Arial', '', 10);
         $this->Cell($w[0], 5, $mod->account->account_no . ". " . $mod->account->account_name, 'LR');
         $this->Cell($w[1], 5, number_format($mod->debit, 0, ',', '.'), 'LR', 0, 'R');
         $this->Cell($w[2], 5, number_format($mod->credit, 0, ',', '.'), 'R', 0, 'R');
         $this->Cell($w[3], 5, $mod->user_remark, 'R');
         $this->Ln();
     }
     $this->SetFont('Arial', 'B', 10);
     $this->Cell($w[0], 6, 'TOTAL', 'TLR', 0, 'R');
     $this->Cell($w[1], 6, number_format($model->journalSum, 0, ',', '.'), 'TLR', 0, 'R');
     $this->Cell($w[2], 6, number_format($model->journalSum, 0, ',', '.'), 'TR', 0, 'R');
     $this->Cell($w[3], 6, '', 'TR');
     $this->Ln();
     //Closure line
     $this->Cell(array_sum($w), 0, '', 'T');
     $this->Ln(2);
     $bilangan = new terbilang();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(0, 4, 'Say: ' . $bilangan->eja($model->journalSum) . "Rupiah");
     $this->Ln(10);
     $w = array(63, 63, 63);
     $this->SetFont('Arial', '', 10);
     $this->Cell($w[0], 6, 'Created By', 'LTR', 0, 'C');
     $this->Cell($w[1], 6, 'Approved By', 'TR', 0, 'C');
     $this->Cell($w[2], 6, 'Receiver', 'TR', 0, 'C');
     $this->Ln();
     $this->Cell($w[0], 18, '', 'LR');
     $this->Cell($w[1], 18, '', 'R');
     $this->Cell($w[2], 18, '', 'R');
     $this->Ln();
     $this->Cell($w[1], 6, '', 'LBR', 0, 'C');
     $this->Cell($w[1], 6, '', 'BR', 0, 'C');
     $this->Cell($w[2], 6, $model->user_ref, 'RB', 0, 'C');
     $this->Ln(5);
     $this->SetFont('Arial', '', 10);
     $this->Cell($w[0], 6, '', 'LBR');
     $this->Cell($w[1], 6, '', 'BR', 0, 'C');
     $this->Cell($w[2], 6, '', 'BR', 0, 'C');
     $this->Ln();
 }
コード例 #10
0
 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'));
     }
 }
コード例 #11
0
<ul class="nav nav-list">
	<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 />
コード例 #12
0
<?php

$this->widget('bootstrap.widgets.BootGridView', array('id' => 'u-journal-detail-grid', 'dataProvider' => uJournalDetail::model()->search($id), 'itemsCssClass' => 'table table-striped table-bordered', 'template' => '{items}{pager}', 'columns' => array(array('name' => 'account_no_id', 'type' => 'raw', 'value' => 'CHtml::link($data->account->account_no.". ".$data->account->account_name,Yii::app()->createUrl("/tAccount/view",array("id"=>$data->account->id)))'), array('name' => 'debit', 'value' => '$data->debitf()', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), array('name' => 'credit', 'value' => '$data->creditf()', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), 'user_remark')));
$this->widget('bootstrap.widgets.BootDetailView', array('data' => uJournal::model()->findByPk((int) $id), 'attributes' => array(array('label' => 'Total', 'value' => Yii::app()->numberFormatter->format("#,##0.00", uJournal::model()->findByPk((int) $id)->journalSum)))));
?>

<?php 
if ($data->state_id == 1 || $data->state_id == 2) {
    $this->widget('zii.widgets.jui.CJuiButton', array('buttonType' => 'link', 'id' => 'myCap' . $id, 'name' => 'btnGo' . $id, 'url' => Yii::app()->createUrl("/tPosting/posting", array("id" => $id)), 'caption' => $data->state_id == 1 ? 'Post' : 'Re-Post', 'options' => array(), 'htmlOptions' => array('class' => 'ui-button-primary')));
} elseif ($data->state_id == 4) {
    $this->widget('zii.widgets.jui.CJuiButton', array('buttonType' => 'link', 'id' => 'myCap' . $id, 'name' => 'btnGo' . $id, 'url' => Yii::app()->createUrl("/tPosting/unposting", array("id" => $id)), 'caption' => 'Un-Post', 'options' => array(), 'htmlOptions' => array('class' => 'ui-button-primary')));
} else {
    $this->widget('zii.widgets.jui.CJuiButton', array('buttonType' => 'link', 'id' => 'myCap' . $id, 'name' => 'btnGo' . $id, 'url' => Yii::app()->createUrl("/tPosting/unlock", array("id" => $id)), 'caption' => 'Un-Lock', 'options' => array()));
}
?>
<hr />
コード例 #13
0
<ul class="nav nav-list">
	<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 />
コード例 #14
0
<?php

$this->breadcrumbs = array('Journal Voucher' => array('/uJournal'), 'Create');
$this->menu = array(array('label' => 'Home', 'url' => array('/uJournal')));
$this->menu1 = uJournal::getTopUpdated(1);
$this->menu2 = uJournal::getTopCreated(1);
?>


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

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

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

<div class="control-group">
	<?php 
echo $form->labelEx($model, 'input_date', array('class' => 'control-label'));
?>
	<div class="controls">
コード例 #15
0
 public function actionCreate()
 {
     $model = new fJournal('cashbank');
     //$this->performAjaxValidation($model);
     $_myDebit = 0;
     $_myCredit = 0;
     $_myBalance = 0;
     $model->balance = "NOT OK";
     if (isset($_POST['account_no_id'])) {
         $model->attributes = $_POST['fJournal'];
         $model->validate();
         if (isset($_POST['fJournal']['cb_receiver'])) {
             //Expense
             $model->account_no_id = $_POST['account_no_id'];
             $model->debit = $_POST['debit'];
             $model->credit = $_POST['credit'];
             $model->user_remark = $_POST['user_remark'];
             foreach ($model->debit as $_debit) {
                 $_myDebit = $_myDebit + $_debit;
             }
             foreach ($model->credit as $_credit) {
                 $_myCredit = $_myCredit + $_credit;
             }
             $_myBalance = $_myDebit - $_myCredit;
             $model->balance = "OK";
             if ($model->validate()) {
                 $modelHeader = new uJournal();
                 $modelHeader->input_date = $_POST['fJournal']['input_date'];
                 $modelHeader->yearmonth_periode = Yii::app()->settings->get("System", "cCurrentPeriod");
                 $modelHeader->remark = $_POST['fJournal']['remark'];
                 $modelHeader->user_ref = $_POST['fJournal']['cb_receiver'];
                 $modelHeader->entity_id = sUser::model()->getGroup();
                 //default Group
                 $modelHeader->module_id = 2;
                 //CB
                 $modelHeader->state_id = 1;
                 $modelHeader->journal_type_id = 2;
                 //CB-expense
                 $modelHeader->save();
                 $_tdebet = 0;
                 $_tcredit = 0;
                 for ($i = 0; $i < sizeof($model->account_no_id); ++$i) {
                     $modelDetail = new uJournalDetail();
                     $modelDetail->parent_id = $modelHeader->id;
                     $modelDetail->account_no_id = $model->account_no_id[$i];
                     if ($model->debit[$i] != null) {
                         $modelDetail->debit = $model->debit[$i];
                     } else {
                         $modelDetail->debit = 0;
                     }
                     if ($model->credit[$i] != null) {
                         $modelDetail->credit = $model->credit[$i];
                     } else {
                         $modelDetail->credit = 0;
                     }
                     $modelDetail->user_remark = $model->user_remark[$i];
                     $modelDetail->save();
                 }
                 $modelDetail = new uJournalDetail();
                 $modelDetail->parent_id = $modelHeader->id;
                 $modelDetail->account_no_id = $_POST['fJournal']['var_account'];
                 $modelDetail->debit = 0;
                 $modelDetail->credit = $_myBalance;
                 $modelDetail->system_remark = "Automated by System";
                 $modelDetail->user_remark = $model->user_remark[0];
                 $modelDetail->save();
                 //Create System_ref
                 $_ref = "CB-" . $modelDetail->account->cashbank->mtext . "-" . $modelHeader->yearmonth_periode . "-EXP-" . str_pad($modelHeader->id, 5, "0", STR_PAD_LEFT);
                 $modelHeader->updateByPk((int) $modelHeader->id, array('system_ref' => $_ref));
                 Yii::app()->user->setFlash("success", "Journal created succesfully...");
                 $this->redirect(array('/mCashbank'));
             }
             $this->render('create', array('model' => $model));
             Yii::app()->end();
         } else {
             //Income
             $model->account_no_id = $_POST['account_no_id'];
             $model->debit = $_POST['debit'];
             $model->credit = $_POST['credit'];
             $model->user_remark = $_POST['user_remark'];
             foreach ($model->debit as $_debit) {
                 $_myDebit = $_myDebit + $_debit;
             }
             foreach ($model->credit as $_credit) {
                 $_myCredit = $_myCredit + $_credit;
             }
             $_myBalance = $_myCredit - $_myDebit;
             $model->balance = "OK";
             if ($model->validate()) {
                 $modelHeader = new uJournal();
                 $modelHeader->input_date = $_POST['fJournal']['input_date'];
                 $modelHeader->yearmonth_periode = Yii::app()->settings->get("System", "cCurrentPeriod");
                 $modelHeader->remark = $_POST['fJournal']['remark'];
                 $modelHeader->user_ref = $_POST['fJournal']['cb_received_from'];
                 $modelHeader->entity_id = sUser::model()->getGroup();
                 //default Group
                 $modelHeader->module_id = 2;
                 //CB
                 $modelHeader->state_id = 1;
                 $modelHeader->journal_type_id = 1;
                 //CB-Income
                 $modelHeader->save();
                 $modelDetail = new uJournalDetail();
                 $modelDetail->parent_id = $modelHeader->id;
                 $modelDetail->account_no_id = $_POST['fJournal']['var_account'];
                 $modelDetail->debit = $_myBalance;
                 $modelDetail->credit = 0;
                 $modelDetail->system_remark = "Automated by System";
                 $modelDetail->user_remark = $model->user_remark[0];
                 $modelDetail->save();
                 //Create System_ref
                 $_ref = "CB-" . $modelDetail->account->cashbank->mtext . "-" . $modelHeader->yearmonth_periode . "-INC-" . str_pad($modelHeader->id, 5, "0", STR_PAD_LEFT);
                 $modelHeader->updateByPk((int) $modelHeader->id, array('system_ref' => $_ref));
                 $_tdebet = 0;
                 $_tcredit = 0;
                 for ($i = 0; $i < sizeof($model->account_no_id); ++$i) {
                     $modelDetail = new uJournalDetail();
                     $modelDetail->parent_id = $modelHeader->id;
                     $modelDetail->account_no_id = $model->account_no_id[$i];
                     if ($model->debit[$i] != null) {
                         $modelDetail->debit = $model->debit[$i];
                     } else {
                         $modelDetail->debit = 0;
                     }
                     if ($model->credit[$i] != null) {
                         $modelDetail->credit = $model->credit[$i];
                     } else {
                         $modelDetail->credit = 0;
                     }
                     $modelDetail->user_remark = $model->user_remark[$i];
                     $modelDetail->save();
                 }
                 Yii::app()->user->setFlash("success", "Journal created succesfully... View Jurnal: " . CHtml::link($modelHeader->system_ref, Yii::app()->createUrl("/mCashbank/view", array("id" => $modelHeader->id))));
                 $this->redirect(array('/mCashbank'));
             }
             $this->render('create', array('model' => $model));
             Yii::app()->end();
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #16
0
 public function loadModel($id)
 {
     $model = uJournal::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #17
0
 function report($acc_id, $begin_date, $end_date)
 {
     $this->myHeader($acc_id, $begin_date, $end_date);
     $criteria = new CDbCriteria();
     $criteria->with = array('journalDetail');
     $criteria->group = 't.id, module_id, input_date, yearmonth_periode, system_ref, state_id';
     $criteria->join = 'INNER JOIN u_journal_detail tt ON t.id = tt.parent_id';
     $criteria->compare('tt.account_no_id', $acc_id);
     $criteria->addBetweenCondition('input_date', Yii::app()->dateFormatter->format('yyyy-MM-dd', $begin_date), Yii::app()->dateFormatter->format('yyyy-MM-dd', $end_date));
     $models = uJournal::model()->findAll($criteria);
     foreach ($models as $model) {
         //Header
         $this->SetFont('Arial', '', 10);
         $this->Cell(25, 4, 'Voucher No.');
         $this->SetFont('Arial', 'B', 10);
         $this->Cell(50, 4, ': ' . $model->system_ref);
         $this->Ln();
         $this->SetFont('Arial', '', 10);
         $this->Cell(25, 4, 'Date');
         $this->SetFont('Arial', 'B', 10);
         $this->Cell(60, 4, ': ' . $model->input_date);
         $this->Ln();
         $this->SetFont('Arial', '', 10);
         $this->Cell(25, 4, 'Periode');
         $this->SetFont('Arial', 'B', 10);
         $this->Cell(60, 4, ': ' . $model->yearmonth_periode);
         $this->Ln(4);
         $this->SetFont('Arial', '', 10);
         $this->Cell(25, 4, 'Description');
         $this->Cell(60, 4, ': ' . $model->remark);
         $this->Ln(6);
         $w = array(70, 25, 25, 70);
         //Header
         $this->SetFont('Arial', 'B', 10);
         $this->Cell($w[0], 9, 'Account Name', 'LTBR', 0, 'C');
         $this->Cell($w[1], 9, 'Debit', 'TBR', 0, 'C');
         $this->Cell($w[2], 9, 'Credit', 'TBR', 0, 'C');
         $this->Cell($w[3], 9, 'Remark', 'TBR', 0, 'C');
         $this->Ln();
         $modeld = uJournalDetail::model()->findAll('parent_id = ' . $model->id);
         foreach ($modeld as $mod) {
             $this->SetFont('Arial', '', 10);
             $this->Cell($w[0], 5, $mod->account->account_concat(), 'LR');
             $this->Cell($w[1], 5, number_format($mod->debit, 0, ',', '.'), 'LR', 0, 'R');
             $this->Cell($w[2], 5, number_format($mod->credit, 0, ',', '.'), 'R', 0, 'R');
             $this->Cell($w[3], 5, $mod->user_remark, 'R');
             $this->Ln();
         }
         $this->SetFont('Arial', 'B', 10);
         $this->Cell($w[0], 6, 'TOTAL', 'TLR', 0, 'R');
         $this->Cell($w[1], 6, number_format($model->journalSum, 0, ',', '.'), 'TLR', 0, 'R');
         $this->Cell($w[2], 6, number_format($model->journalSum, 0, ',', '.'), 'TR', 0, 'R');
         $this->Cell($w[3], 6, '', 'TR');
         $this->Ln();
         $this->Cell(array_sum($w), 6, '', 'T');
         $this->Ln(8);
         if ($this->GetY() >= 215) {
             $this->AddPage();
             $this->myHeader($acc_id, $begin_date, $end_date);
         }
     }
 }