<ul class="nav nav-list"> <li class="nav-header">Purchase Order</li> </ul> <?php $this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => array(array('label' => 'Created Last 7 days ', 'count' => aPorder::model()->getNewlyPO(), 'icon' => 'list-alt', 'url' => array('/m1/aPorder'))))); ?> <br /> <ul class="nav nav-list"> <li class="nav-header">Approval Form</li> </ul> <?php $this->widget('bootstrap.widgets.BootMenu', array('type' => 'list', 'items' => array(array('label' => 'Waiting For Approval', 'count' => aPorder::model()->getWaitingApproval(), 'icon' => 'list-alt', 'url' => array('/m1/aApprovalForm')), array('label' => 'Waiting For Payment', 'count' => aPorder::model()->getWaitingPayment(), 'icon' => 'list-alt', 'url' => array('/m1/aApprovalForm', 'id' => 2))))); ?> <br /> <ul class="nav nav-list"> <li class="nav-header">Top Budget Realization (CP)</li> </ul> <?php //$this->widget('bootstrap.widgets.BootMenu', array( //'type'=>'list', //'items'=>aBudget::model()->getTopTenBudgetCP(), //)); ?> <br /> <ul class="nav nav-list">
public function actionUpdateApproved($id) { $model = $this->loadModel($id); if ($model->approved_date == null) { #---------------------------------------- #Budget Detail $modelbd = aBudgetDetail::model()->find(array('condition' => 'parent_id = :parent', 'params' => array(':parent' => $model->budgetcomp_id))); if ($modelbd == null) { //Step 1. null berarti saldo baru berjalan, jadi cek saldo awal $modelbd1 = new aBudgetDetail(); $modelbd1->parent_id = $model->budgetcomp_id; $modelbd1->input_date = new CDbExpression("now()"); $modelbd1->periode_date = 0; $modelbd1->no_ref = 'temp'; $modelbd1->prequest_id = 0; $modelbd1->tdebt = $model->budgetcomp->amount; $modelbd1->balance = $model->budgetcomp->amount; $modelbd1->created_by = 'admin'; $modelbd1->created_date = time(); $modelbd1->save(); } //Step 2. Get Saldo $bd_balance = aBudgetDetail::model()->getSaldo($model->budgetcomp_id); $command = Yii::app()->db->createCommand('INSERT INTO a_budget_detail (parent_id, input_date, periode_date, no_ref, prequest_id, tdebt, tcredit, balance, remark, created_date, created_by) SELECT a.budgetcomp_id, a.input_date, a.periode_date, a.no_ref, a.id, 0, Sum(b.qty*b.amount), :balance - Sum(b.qty*b.amount), \'Automatic Posting\', ' . time() . ',\'' . Yii::app()->user->name . '\' FROM a_porder a INNER JOIN a_porder_detail b ON a.id = b.parent_id WHERE a.id = :id GROUP BY a.budgetcomp_id, a.input_date, a.no_ref, a.id'); $command->bindParam(":id", $id, PDO::PARAM_STR); $command->bindParam(":balance", $bd_balance, PDO::PARAM_STR); $command->execute(); #------------------------------------ #Budget Department /* foreach ($model->po_detail_group as $mod) { $criteria=new CDbCriteria; $criteria->compare('parent_id',$mod->budget_id); $criteria->compare('department_id',$mod->department_id); $cekDeptBudget=aBudget::model()->find($criteria); //Cek Budget Besar Apakah ada budget dept dari component ini if ($cekDeptBudget != null) { //Jika tidak ada ignore $modelbd=aBudgetDepartment::model()->find($criteria); if($modelbd==null) { //Step 1. Cek Existing Data. Jika belom pernah diisi, maka diisi $modelbd1=new aBudgetDepartment; $modelbd1->parent_id=$mod->budget_id; $modelbd1->input_date = new CDbExpression("now()"); $modelbd1->periode_date=0; $modelbd1->no_ref='temp'; $modelbd1->department_id =$mod->department_id; $modelbd1->tdebt=$cekDeptBudget->amount; //karena budget-nya ada, amountnya diambil $modelbd1->tcredit=0; $modelbd1->balance=$cekDeptBudget->amount; //karena budget-nya ada, amountnya diambil $modelbd1->created_by='admin'; $modelbd1->created_date=time(); $modelbd1->save(); } //Step 2. Get Saldo, baik diproses dari saldo diatas maupun existing Saldo $bd_balanceDept = aBudgetDepartment::model()->getSaldo($mod->budget_id,$mod->department_id); } else { //Step 2. Get Saldo, baik diproses dari saldo diatas maupun existing Saldo $bd_balanceDept = $mod->sub_total; } $command=Yii::app()->db->createCommand(); $command->insert('a_budget_department',array( 'parent_id'=>$mod->budget_id, 'input_date'=>$model->input_date, 'periode_date'=>$model->periode_date, 'no_ref'=>$model->no_ref, 'department_id'=>$mod->department_id, 'tdebt'=>0, 'tcredit'=>$mod->sub_total, 'balance'=>$bd_balanceDept-$mod->sub_total, 'remark'=>"Automatic Posting", 'created_date'=>time(), 'created_by'=>Yii::app()->user->id, )); } */ $_date = Yii::app()->dateFormatter->format("yyyy-MM-dd", time()); aPorder::model()->updateByPk((int) $model->id, array('approved_date' => $_date)); } }
function pRequestR1($id) { $this->myheader4($id); $criteria = new CDbCriteria(); $criteria->compare('parent_id', $id); $models = aPorderDetail::model()->findAll($criteria); $_counter = 1; $_countert = 1; $_totalc = 0; $_totals = 0; $w = array(6, 65, 40, 10, 10, 20, 20, 25, 15, 10, 10, 10, 10, 20); $x = $this->GetX(); $y = $this->GetY(); foreach ($models as $mod) { $this->SetFont('Arial', '', 8); $x0 = $this->GetX(); $y0 = $this->GetY(); $this->Cell($w[0], 4, number_format($_countert, 0, ',', '.'), 'L', 0, 'R'); $y1 = $this->GetY(); $this->MultiCell($w[1], 4, aBudget::model()->findByPk($mod->budget_id)->code . " " . $mod->description, 'LB'); $y2 = $this->GetY(); $yH = $y2 - $y1; $yC = $this->GetY(); $this->SetXY($x0, $y0); $this->Cell($w[0], $yH, '', 'LB'); //Garis samping $this->SetXY($x + $w[0] + $w[1], $yC - $yH); $this->Cell($w[2], $yH, $mod->user, 'LB'); $this->Cell($w[3], $yH, $mod->uom, 'LB'); $this->Cell($w[4], $yH, $mod->qty, 'LB', 0, 'R'); $this->Cell($w[5], $yH, '', 'LB', 0, 'R'); $this->Cell($w[6], $yH, sParameter::cDateDisplay(strtotime($mod->need_date)), 'LB', 0, 'R'); $this->Cell($w[7], $yH, '', 'LB', 0, 'R'); $this->Cell($w[8], $yH, '', 'LB', 0, 'R'); $this->Cell($w[9], $yH, '', 'LB', 0, 'R'); $this->Cell($w[10], $yH, '', 'LB', 0, 'R'); $this->Cell($w[11], $yH, '', 'LB', 0, 'R'); $this->Cell($w[12], $yH, '', 'LB', 0, 'R'); $this->Cell($w[13], $yH, '', 'LBR', 0, 'R'); $this->Ln(); $_totalc = $_totalc + $mod->qty; $_totals = $_totals + aBudget::model()->findByPk($mod->budget_id)->amount; $_counter++; $_countert++; //if ($_counter==34) { // $this->AddPage(); // $this->myheader4($id); // $_counter = 1; //} } //Closure line $this->Cell(array_sum($w), 0, '', 'T'); $this->Ln(2); $this->SetFont('Arial', 'B', 8); $this->Cell($w[0], 5, '', 'TLB'); $this->Cell($w[1], 5, 'T O T A L', 'TLB', 0, 'C'); $this->Cell($w[2], 5, '', 'TLB'); $this->Cell($w[3], 5, '', 'TLB'); $this->Cell($w[4], 5, number_format($_totalc, 0, ',', '.'), 'TLBR', 0, 'R'); $this->Cell($w[5], 5, '', 'TLBR', 0, 'R'); $this->Cell($w[6], 5, '', 'TLB'); $this->Cell($w[7], 5, '', 'TLB'); $this->Cell($w[8], 5, '', 'TLB'); $this->Cell($w[9], 5, '', 'TLB'); $this->Cell($w[10], 5, '', 'TLB'); $this->Cell($w[11], 5, '', 'TLB'); $this->Cell($w[12], 5, '', 'TLB'); $this->Cell($w[13], 5, '', 1); $this->Ln(10); $this->SetFont('Arial', '', 8); $this->Cell(30, 6, 'Keterangan:'); $this->Ln(4); $this->Cell(0, 6, aPorder::model()->findByPk($mod->parent_id)->remark); $this->Ln(14); $this->SetFont('Arial', '', 10); $this->Cell($w[0], 6, '', 'LT'); $this->Cell($w[1], 6, 'Requested By', 'TR', 0, 'C'); $this->Cell($w[2], 6, '', 'T', 0, 'C'); $this->Cell($w[3], 6, '', 'T', 0, 'C'); $this->Cell($w[4], 6, '', 'T', 0, 'C'); $this->Cell($w[5], 6, '', 'T', 0, 'C'); $this->Cell($w[6], 6, '', 'T', 0, 'C'); $this->Cell($w[7], 6, 'Acknowledge By:', 'T', 0, 'C'); $this->Cell($w[8], 6, '', 'T', 0, 'C'); $this->Cell($w[9], 6, '', 'T', 0, 'C'); $this->Cell($w[10], 6, '', 'T', 0, 'C'); $this->Cell($w[11], 6, '', 'T', 0, 'C'); $this->Cell($w[12], 6, '', 'T', 0, 'C'); $this->Cell($w[13], 6, '', 'TR', 0, 'C'); $this->Ln(); $this->Cell($w[0], 18, '', 'L'); $this->Cell($w[1], 18, '', 'R'); $this->Cell($w[2], 18); $this->Cell($w[3], 18); $this->Cell($w[4], 18); $this->Cell($w[5], 18); $this->Cell($w[6], 18); $this->Cell($w[7], 18); $this->Cell($w[8], 18); $this->Cell($w[9], 18); $this->Cell($w[10], 18); $this->Cell($w[11], 18); $this->Cell($w[12], 18); $this->Cell($w[13], 18, '', 'R'); $this->Ln(); $this->Cell($w[0], 6, '', 'L'); $this->Cell($w[1], 6, 'Silvia Theresia', 'R', 0, 'C'); $this->Cell($w[2], 6, '', 0, 0, 'C'); $this->Cell($w[3], 6, '', 0, 0, 'C'); $this->Cell($w[4] + $w[5], 6, 'Hadi Sutanto', 0, 0, 'C'); $this->Cell($w[6], 6, '', 0, 0, 'C'); $this->Cell($w[7], 6, '', 0, 0, 'C'); $this->Cell($w[8], 6, '', 0, 0, 'C'); $this->Cell($w[9] + $w[10] + $w[11], 6, 'Indra W. Antono', 0, 0, 'C'); $this->Cell($w[12], 6, '', 0, 0, 'C'); $this->Cell($w[13], 6, '', 'R', 'C'); $this->Ln(3); $this->SetFont('Arial', '', 8); $this->Cell($w[0], 6, '', 'LB'); $this->Cell($w[1], 6, 'Office Support Manager', 'BR', 0, 'C'); $this->Cell($w[2], 6, '', 'B', 0, 'C'); $this->Cell($w[3], 6, '', 'B', 0, 'C'); $this->Cell($w[4] + $w[5], 6, 'Fin & Acc Deputy Director', 'B', 0, 'C'); $this->Cell($w[6], 6, '', 'B', 0, 'C'); $this->Cell($w[7], 6, '', 'B', 0, 'C'); $this->Cell($w[8], 6, '', 'B', 0, 'C'); $this->Cell($w[9] + $w[10] + $w[11], 6, 'Marketing Director', 'B', 0, 'C'); $this->Cell($w[12], 6, '', 'B', 0, 'C'); $this->Cell($w[13], 6, '', 'BR', 'C'); $this->Ln(); $this->SetFont('Arial', 'BI', 8); $this->Cell(0, 6, aPorder::model()->findByPk($mod->parent_id)->no_ref . " ", 0, 0, 'R'); $this->Ln(); }
function pRequestR2($id) { $this->myheader4($id); $criteria = new CDbCriteria(); $criteria->compare('parent_id', $id); $criteria->compare('tcredit>', 0); $criteria->order = 'periode_date, id'; $models = aBudgetDetail::model()->findAll($criteria); $_counter = 1; $_countert = 1; $_totalc = 0; $_totals = 0; $w = array(8, 25, 50, 30, 30, 30, 40, 50); //Saldo Awal $criteria1 = new CDbCriteria(); $criteria1->compare('parent_id', $id); $criteria1->compare('tdebt>', 0); $criteria1->order = 'periode_date, id'; $modelt = aBudgetDetail::model()->find($criteria1); $this->SetFont('Arial', '', 8); $this->Cell($w[0], 6, $_counter, 'LB', 0, 'R'); $this->Cell($w[1], 6, $modelt->input_date, 'LB'); $this->Cell($w[2], 6, $modelt->no_ref, 'LB'); $this->Cell($w[3], 6, $modelt->periode_date, 'LB'); $this->Cell($w[4], 6, '', 'LB', 0, 'R'); $this->SetFont('Arial', 'B', 8); $this->Cell($w[5], 6, number_format($modelt->tdebt, 0, ',', '.'), 'LB', 0, 'R'); $this->Cell($w[6], 6, '', 'LB'); $this->SetFont('Arial', '', 8); $this->Cell($w[7], 6, $modelt->remark, 'LBR'); $this->Ln(); //End of Saldo Awal $_counter++; foreach ($models as $mod) { $this->SetFont('Arial', '', 8); $this->Cell($w[0], 6, $_counter, 'LB', 0, 'R'); $this->Cell($w[1], 6, $mod->input_date, 'LB'); $this->Cell($w[2], 6, $mod->no_ref, 'LB'); $this->Cell($w[3], 6, sParameter::BulanTahun1($mod->periode_date), 'LB'); $this->Cell($w[4], 6, number_format($mod->tcredit, 0, ',', '.'), 'LB', 0, 'R'); $this->Cell($w[4], 6, number_format($mod->balance, 0, ',', '.'), 'LB', 0, 'R'); $this->Cell($w[6], 6, aPorder::model()->issuerBy((int) $mod->prequest_id), 'LB'); $this->Cell($w[7], 6, $mod->remark, 'LBR'); $this->Ln(); $_totalc = $_totalc + $mod->tcredit; $_counter++; $_countert++; //if ($_counter==34) { // $this->AddPage(); // $this->myheader4($id); // $_counter = 1; //} } //Closure line $this->Cell(array_sum($w), 0, '', 'T'); $this->Ln(2); $w = array(8, 25, 50, 30, 30, 30, 40, 50); $this->SetFont('Arial', 'B', 8); $this->Cell($w[0], 6, '', 1); $this->Cell($w[1], 6, '', 1, 0, 'C'); $this->Cell($w[2], 6, '', 1, 0, 'C'); $this->Cell($w[3], 6, '', 1, 0, 'C'); $this->Cell($w[4], 6, number_format($_totalc, 0, ',', '.'), 1, 0, 'R'); $this->Cell($w[5], 6, number_format($mod->balance, 0, ',', '.'), 1, 0, 'R'); $this->Cell($w[6], 6, '', 1, 0, 'C'); $this->Cell($w[7], 6, '', 1, 0, 'C'); $this->Ln(); /* $this->SetFont('Arial','',8); $this->Cell(30,6,'Keterangan'); $this->Ln(); $this->Cell(0,6,aBudgetDetail::model()->findByPk($mod->parent_id)->remark); $this->Ln(10); $this->SetFont('Arial','',10); $this->Cell($w[0],6,'','LT'); $this->Cell($w[1],6,'Requested By','TR',0,'C'); $this->Cell($w[2],6,'','T',0,'C'); $this->Cell($w[3],6,'','T',0,'C'); $this->Cell($w[4],6,'','T',0,'C'); $this->Cell($w[5],6,'','T',0,'C'); $this->Cell($w[6],6,'','T',0,'C'); $this->Cell($w[7],6,'Acknowledge By:','T',0,'C'); $this->Cell($w[8],6,'','T',0,'C'); $this->Cell($w[9],6,'','T',0,'C'); $this->Cell($w[10],6,'','T',0,'C'); $this->Cell($w[11],6,'','T',0,'C'); $this->Cell($w[12],6,'','T',0,'C'); $this->Cell($w[13],6,'','TR',0,'C'); $this->Ln(); $this->Cell($w[0],18,'','L'); $this->Cell($w[1],18,'','R'); $this->Cell($w[2],18); $this->Cell($w[3],18); $this->Cell($w[4],18); $this->Cell($w[5],18); $this->Cell($w[6],18); $this->Cell($w[7],18); $this->Cell($w[8],18); $this->Cell($w[9],18); $this->Cell($w[10],18); $this->Cell($w[11],18); $this->Cell($w[12],18); $this->Cell($w[13],18,'','R'); $this->Ln(); $this->Cell($w[0],6,'','L'); $this->Cell($w[1],6,'Silvia Theresia','R',0,'C'); $this->Cell($w[2],6,'',0,0,'C'); $this->Cell($w[3],6,'',0,0,'C'); $this->Cell($w[4]+$w[5],6,'Hadi Sutanto',0,0,'C'); $this->Cell($w[6],6,'',0,0,'C'); $this->Cell($w[7],6,'',0,0,'C'); $this->Cell($w[8],6,'',0,0,'C'); $this->Cell($w[9]+$w[10]+$w[11],6,'Indra W. Antono',0,0,'C'); $this->Cell($w[12],6,'',0,0,'C'); $this->Cell($w[13],6,'','R','C'); $this->Ln(3); $this->SetFont('Arial','',8); $this->Cell($w[0],6,'','LB'); $this->Cell($w[1],6,'Office Support Manager','BR',0,'C'); $this->Cell($w[2],6,'','B',0,'C'); $this->Cell($w[3],6,'','B',0,'C'); $this->Cell($w[4]+$w[5],6,'Fin & Acc Deputy Director','B',0,'C'); $this->Cell($w[6],6,'','B',0,'C'); $this->Cell($w[7],6,'','B',0,'C'); $this->Cell($w[8],6,'','B',0,'C'); $this->Cell($w[9]+$w[10]+$w[11],6,'Marketing Director','B',0,'C'); $this->Cell($w[12],6,'','B',0,'C'); $this->Cell($w[13],6,'','BR','C'); $this->Ln(); $this->SetFont('Arial','BI',8); $this->Cell(0,6,aBudgetDetail::model()->findByPk($mod->parent_id)->no_ref . " ",0,0,'R'); $this->Ln(); */ }
echo "Pending"; } elseif ($id == 2) { echo "UnPaid"; } else { ""; } ?> </h1> </div> <?php $this->widget('bootstrap.widgets.BootMenu', array('type' => 'pills', 'stacked' => false, 'items' => array(array('label' => 'Waiting for Approval', 'url' => Yii::app()->createUrl('/m1/aPorder', array("id" => 1)), 'active' => $id == 1), array('label' => 'Waiting for Payment', 'url' => Yii::app()->createUrl('/m1/aPorder', array("id" => 2)), 'active' => $id == 2), array('label' => 'Paid', 'url' => Yii::app()->createUrl('/m1/aPorder', array("id" => 3)), 'active' => $id == 3), array('label' => 'Show All', 'url' => Yii::app()->createUrl('/m1/aPorder', array("id" => 0)), 'active' => $id == 0)))); ?> <?php $this->widget('bootstrap.widgets.BootGridView', array('id' => 'aPorder-grid', 'dataProvider' => aPorder::model()->search($id), 'itemsCssClass' => 'table table-striped table-bordered', 'template' => '{items}{pager}{summary}', 'columns' => array(array('class' => 'BootButtonColumn', 'template' => '{print}', 'buttons' => array('print' => array('label' => 'Print', 'url' => 'Yii::app()->createUrl("/m1/aPorder/report1", array("id"=>$data->id))', 'options' => array('class' => 'btn btn-mini')))), array('header' => 'For Department', 'value' => '$data->organization->name', 'visible' => Yii::app()->user->name == "admin"), 'input_date', array('name' => 'no_ref', 'type' => 'raw', 'value' => 'CHtml::link($data->no_ref,Yii::app()->createUrl("/m1/aPorder/view",array("id"=>$data->id)))'), 'periode_date', array('header' => 'Main Category', 'value' => '$data->budgetcomp->getCodeName()'), array('header' => 'Total', 'value' => '$data->sum_pof()', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), 'approved_date', 'payment_date', array('class' => 'BootButtonColumn', 'template' => '{myView}{myUpdate}', 'buttons' => array('myView' => array('label' => '<i class="icon-zoom-in"></i>', 'url' => '$this->grid->controller->createUrl("/m1/aPorder/view", array("id"=>$data->id,"asDialog"=>1,"gridId"=>$this->grid->id))', 'click' => 'function(){$("#cru-frame").attr("src",$(this).attr("href")); $("#cru-dialog").dialog("open"); return false;}'), 'myUpdate' => array('label' => '<i class="icon-pencil"></i>', 'url' => 'Yii::app()->createUrl("/m1/aPorder/update", array("id"=>$data->id))'))), array('class' => 'BootButtonColumn', 'template' => '{delete}', 'deleteButtonLabel' => '<i class="icon-trash"></i>', 'deleteButtonImageUrl' => false, 'visible' => $id == 1)))); ?> <?php //--------------------- begin new code -------------------------- // add the (closed) dialog for the iframe $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'cru-dialog', 'options' => array('title' => 'View Detail', 'autoOpen' => false, 'modal' => true, 'width' => '70%', 'height' => '500'))); ?> <iframe id="cru-frame" width="100%" height="100%"></iframe> <?php $this->endWidget(); //--------------------- end new code -------------------------- $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'mydialog', 'options' => array('title' => 'Payment Process', 'autoOpen' => false, 'modal' => true))); echo 'Posting Complete...'; $this->endWidget('zii.widgets.jui.CJuiDialog');
<?php if ($id == 300 || $id != null && aBudget::model()->findByPk((int) $id)->parent_id == 300) { echo "<h2>List of AF</h2>"; $this->widget('bootstrap.widgets.BootGridView', array('itemsCssClass' => 'table table-striped table-bordered', 'id' => 'aPorder-grid', 'dataProvider' => aPorder::model()->approvalForm(0, $id), 'template' => '{items}{pager}', 'columns' => array('input_date', array('name' => 'no_ref', 'type' => 'raw', 'value' => 'CHtml::link($data->no_ref,Yii::app()->createUrl("/m1/aPorder/view",array("id"=>$data->id)))'), 'periode_date', 'remark', array('header' => 'Total', 'value' => '$data->sum_pof()', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), 'approved_date', 'payment_date'))); }
function approvalFormR1($id) { $criteria = new CDbCriteria(); $model = aPorder::model()->with('po_detail')->findByPk((int) $id); $this->myHeader($model); $w = array(13, 93, 20, 20, 22, 22); $this->SetFont('Arial', '', 8); $this->Cell($w[0], 4, 'Previous Approval Form:', 'B'); $this->Cell($w[1], 4, '', 'B'); $this->Cell($w[2], 4, '', 'B'); $this->Cell($w[3], 4, '', 'B'); $this->Cell($w[4], 4, '', 'B'); $this->Cell($w[5], 4, '', 'B'); $this->Ln(); $modelp = aPorder::model()->with('po_detail')->findAll(array('condition' => 'length(approved_date) <> 0 AND t.id <> ' . $id . ' AND budgetcomp_id = ' . $model->budgetcomp_id, 'order' => 't.id')); $this->SetFont('Arial', '', 8); foreach ($modelp as $modp) { $this->Cell($w[0], 6, '', 'LR'); $this->SetFont('Arial', 'B', 8); $this->Cell($w[1], 6, $modp->input_date . ' ' . $modp->no_ref, 'LR'); $this->SetFont('Arial', '', 8); $this->Cell($w[2], 6, number_format($modp->sum_po, 0, ',', '.'), 'LR', 0, 'R'); $this->Cell($w[3], 6, '', 'LR'); $this->Cell($w[4], 6, '', 'LR'); $this->Cell($w[5], 6, '', 'LR'); $this->Ln(); } $this->Cell($w[0], 1, '', 'T'); $this->Cell($w[1], 1, '', 'T'); $this->Cell($w[2], 1, '', 'T'); $this->Cell($w[3], 1, '', 'T'); $this->Cell($w[4], 1, '', 'T'); $this->Cell($w[5], 1, '', 'T'); $this->Ln(); $this->SetFont('Arial', '', 8); $this->Cell($w[0], 4, 'Current Requisition:', 'B'); $this->Cell($w[1], 4, '', 'B'); $this->Cell($w[2], 4, '', 'B'); $this->Cell($w[3], 4, '', 'B'); $this->Cell($w[4], 4, '', 'B'); $this->Cell($w[5], 4, '', 'B'); $this->Ln(); //Detail $_total = 0; $_total1 = 0; $_counter = 1; $_countert = 1; $this->SetFont('Arial', '', 8); $w = array(13, 93, 20, 20, 22, 22); $x = $this->GetX(); $y = $this->GetY(); $_dept = 0; foreach ($model->po_detail as $mod) { if ($mod->department_id != $_dept) { $this->SetFont('Arial', 'B', 8); $this->Cell($w[0], 4, '', 'LR'); $this->Cell($w[1], 4, $mod->po->organization->name, 'LR'); $this->Cell($w[2], 4, '', 'LR', 0, 'R'); $this->Cell($w[3], 4, '', 'LR', 0, 'R'); $this->Cell($w[4], 4, '', 'LR'); $this->Cell($w[5], 4, '', 'LR'); $this->Ln(); $_dept = $mod->department_id; } $this->SetFont('Arial', '', 6); $this->Cell($w[0], 4, $mod->budget->code, 'LR'); $this->SetFont('Arial', '', 8); $this->Cell($w[1], 4, $mod->budget->name, 'LR'); $this->Cell($w[2], 4, '', 'LR', 0, 'R'); $this->Cell($w[3], 4, '', 'LR', 0, 'R'); $this->Cell($w[4], 4, number_format($mod->qty * $mod->amount, 0, ',', '.'), 'LR', 0, 'R'); $this->Cell($w[5], 4, '', 'LR', 0, 'R'); $this->Ln(); $this->SetFont('Arial', '', 6); $y8 = $this->GetY(); $this->Cell($w[0], 4, '', 'LR'); $y9 = $this->GetY(); $yZ = $y9 - $y8; $y1 = $this->GetY(); $this->MultiCell($w[1], 3, $mod->description, 'LBR'); $y2 = $this->GetY(); $yH = $y2 - $y1; $this->SetXY($x, $this->GetY() - $yZ); $this->Cell($w[0], $yZ, '', 'LB'); //Garis samping $this->SetXY($x + $w[0], $this->GetY() - $yH); $this->Cell($w[1], $yH, '', 0); $this->Cell($w[2], $yH, '', 'BR'); $this->Cell($w[3], $yH, '', 'BR'); $this->Cell($w[4], $yH, '', 'BR'); $this->Cell($w[5], $yH, '', 'BR'); $this->Ln(); $_total = $_total + $mod->qty * $mod->amount; $_counter++; $_countert++; $y1 = $this->GetY(); if ($y1 > 235) { $this->Cell($w[0], 1, '', 'B'); $this->Cell($w[1], 1, '', 'B'); $this->Cell($w[2], 1, '', 'B'); $this->Cell($w[3], 1, '', 'B'); $this->Cell($w[4], 1, '', 'B'); $this->Cell($w[5], 1, '', 'BR'); $this->Ln(); $this->AddPage(); $this->myHeader($model); $this->Cell($w[0], 0, '', 'B'); $this->Cell($w[1], 0, '', 'B'); $this->Cell($w[2], 0, '', 'B'); $this->Cell($w[3], 0, '', 'B'); $this->Cell($w[4], 0, '', 'B'); $this->Cell($w[5], 0, '', 'B'); $this->Ln(); } } $y1 = $this->GetY(); $y = 235 - $y1; $this->Cell($w[0], $y, '', 'LR'); $this->Cell($w[1], $y, '', 'LR', 0, 'R'); $this->Cell($w[2], $y, '', 'LR', 0, 'R'); $this->Cell($w[3], $y, '', 'LR'); $this->Cell($w[4], $y, '', 'LR'); $this->Cell($w[5], $y, '', 'LR'); $this->Ln(); $this->Cell($w[0], 1, '', 'TB'); $this->Cell($w[1], 1, '', 'TB'); $this->Cell($w[2], 1, '', 'TB'); $this->Cell($w[3], 1, '', 'TB'); $this->Cell($w[4], 1, '', 'TB'); $this->Cell($w[5], 1, '', 'TB'); $this->Ln(); $w = array(47, 47, 48, 48); $this->Cell($w[0], 4, 'Date', 'LTR'); $this->Cell($w[1], 4, 'Date', 'LTR'); $this->Cell($w[2], 4, 'Approved By', 'LTR'); $this->Cell($w[3], 4, 'Approved By', 'LTR'); $this->Ln(); $this->Cell($w[0], 4, 'Proposed By', 'LR'); $this->Cell($w[1], 4, '', 'LR'); $this->Cell($w[2], 4, '', 'LR'); $this->Cell($w[3], 4, '', 'LR'); $this->Ln(); $this->Cell($w[0], 20, '', 'LR'); $this->Cell($w[1], 20, '', 'LR'); $this->Cell($w[2], 20, '', 'LR'); $this->Cell($w[3], 20, '', 'LR'); $this->Ln(); $this->SetFont('Arial', 'B', 8); $this->Cell($w[0], 4, 'Peter J. Kambey', 'LR', 0, 'C'); $this->Cell($w[1], 4, 'Silvia Theresia', 'LR', 0, 'C'); $this->Cell($w[2], 4, 'Irhan Suwito', 'LR', 0, 'C'); $this->Cell($w[3], 4, 'Indra W. Antono', 'LR', 0, 'C'); $this->Ln(); $this->SetFont('Arial', '', 8); $this->Cell($w[0], 4, 'Supervisor', 'LBR', 0, 'C'); $this->Cell($w[1], 4, 'Cost Controller Dept', 'LBR', 0, 'C'); $this->Cell($w[2], 4, '(Accounting Manager)', 'LBR', 0, 'C'); $this->Cell($w[3], 4, '(Marketing Director)', 'LBR', 0, 'C'); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = aPorder::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
function approvalFormR2($id) { $criteria = new CDbCriteria(); $model = aPorder::model()->findByPk((int) $id); /**/ $_amount = $model->budgetcomp->amount; $_actual = $model->budgetcomp->sum_budget; $_currentbalance = $_amount - $_actual; $_newbalance = $_currentbalance - $model->sum_po; $this->SetFont('Arial', 'B', 6); $this->Cell(50, 4, 'PT. AGUNG PODOMORO LAND, Tbk'); $this->Ln(3); $this->Cell(50, 4, 'Budget Position'); $this->Cell(100); $this->Ln(5); $_paid = aBudget::model()->allComponentPaid($model->budgetcomp_id, 2012, 1); $_unpaid = $_actual - $_paid; $_paidP = $_actual != 0 ? $_paid / $_actual * 100 : 0; $_unpaidP = $_actual != 0 ? $_unpaid / $_actual * 100 : 0; //Header $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'Project:'); $this->SetFont('Arial', 'B', 6); $this->Cell(40, 3, $model->organization->getTopLevel()); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'Budget: ' . $model->budgetcomp->name, 0, 0, 'R'); $this->SetFont('Arial', 'B', 6); $this->Cell(30, 3, number_format($_amount, 0, ',', '.'), 0, 0, 'R'); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'Paid', 0, 0, 'R'); $this->SetFont('Arial', 'B', 6); $this->Cell(20, 3, number_format($_paid, 0, ',', '.'), 0, 0, 'R'); $this->Cell(10, 3, round($_paidP, 2) . "%", 0, 0, 'R'); $this->Ln(3); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'Department:'); $this->SetFont('Arial', 'B', 6); $this->Cell(40, 3, $model->organization->name); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'Realization', 'B', 0, 'R'); $this->SetFont('Arial', 'B', 6); $this->Cell(30, 3, number_format($_actual, 0, ',', '.'), 'B', 0, 'R'); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'UnPaid', 0, 0, 'R'); $this->SetFont('Arial', 'B', 6); $this->Cell(20, 3, number_format($_unpaid, 0, ',', '.'), 'B', 0, 'R'); $this->Cell(10, 3, round($_unpaidP, 2) . "%", 'B', 0, 'R'); $this->Ln(3); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'Budget Category:'); $this->SetFont('Arial', 'B', 6); $this->Cell(40, 3, $model->budgetcomp->name); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'Current Budget Position', 0, 0, 'R'); $this->SetFont('Arial', 'B', 6); $this->Cell(30, 3, number_format($_currentbalance, 0, ',', '.'), 0, 0, 'R'); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'TOTAL', 0, 0, 'R'); $this->SetFont('Arial', 'B', 6); $this->Cell(20, 3, number_format($_paid + $_unpaid, 0, ',', '.'), 0, 0, 'R'); $this->Cell(10, 3, round($_paidP + $_unpaidP, 2) . "%", 0, 0, 'R'); $this->Ln(3); $this->SetFont('Arial', '', 6); $this->Cell(30, 3, 'Date'); $this->SetFont('Arial', 'B', 6); $this->Cell(50, 3, $model->input_date); $this->Ln(6); $w = array(15, 85, 22, 22, 22, 22); $this->SetFont('Arial', 'B', 8); $this->Cell($w[0] + $w[1] + $w[2], 6, 'Description', 'TLR'); $this->Cell($w[3], 6, 'Budget Comp.', 1, 0, 'C'); $this->Cell($w[4], 6, 'Payment Status', 1, 0, 'C'); $this->Cell($w[5], 6, 'Payment Date', 1, 0, 'C'); $this->Ln(); $this->Cell($w[0], 1, '', 'T'); $this->Cell($w[1], 1, '', 'T'); $this->Cell($w[2], 1, '', 'T'); $this->Cell($w[3], 1, '', 'T'); $this->Cell($w[4], 1, '', 'T'); $this->Cell($w[5], 1, '', 'T'); $this->Ln(); //$modelp=aPorder::model()->with('po_detail')->findAll(array('condition'=>'length(approved_date) <> 0 AND budgetcomp_id = ' .$model->budgetcomp_id,'order'=>'t.id')); $modelp = aPorder::model()->with('po_detail')->findAll(array('condition' => 'length(approved_date) <> 0 AND t.id <> ' . $id . ' AND budgetcomp_id = ' . $model->budgetcomp_id, 'order' => 't.id')); $this->SetFont('Arial', '', 8); foreach ($modelp as $modp) { $this->SetFont('Arial', 'B', 8); $this->Cell($w[0] + $w[1], 6, $modp->no_ref, 'LT'); $this->Cell($w[2], 6, '', 'T'); $this->Cell($w[3], 6, number_format($modp->sum_po, 0, ',', '.'), 'TLR', 0, 'R'); $this->Cell($w[4], 6, '', 'T'); $this->Cell($w[5], 6, '', 'LRT'); $this->Ln(); //Detail $_total = 0; $_total1 = 0; $_counter = 1; $_countert = 1; $this->SetFont('Arial', '', 8); $w = array(15, 85, 22, 22, 22, 22); $x = $this->GetX(); $y = $this->GetY(); $_dept = 0; foreach ($modp->po_detail as $mod) { $_desc = strlen($mod->description) < 80 ? $mod->description : substr($mod->description, 0, 80) . '...'; $this->SetFont('Arial', '', 6); $this->Cell($w[0] + $w[1] + $w[2], 4, ' ' . $mod->budget->code . '. ' . $mod->budget->name . '. ' . $_desc, 'LR'); $this->Cell($w[3], 4, number_format($mod->qty * $mod->amount, 0, ',', '.'), 'LR', 0, 'R'); $this->Cell($w[4], 4, isset($mod->payment) ? $mod->payment->name : '', 'LR', 0, 'R'); $this->Cell($w[5], 4, '', 'LR', 0, 'R'); $this->Ln(); $_total = $_total + $mod->qty * $mod->amount; $_counter++; $_countert++; } $this->Cell(array_sum($w), 4, '', 'T'); $this->Ln(2); } }
<?php $this->widget('bootstrap.widgets.BootGridView', array('id' => 'aPorder-grid', 'dataProvider' => aPorder::model()->approvalForm($id, $cid), 'itemsCssClass' => 'table table-striped table-bordered', 'template' => '{items}{pager}{summary}', 'columns' => array(array('class' => 'BootButtonColumn', 'template' => '{approved}{payment}', 'buttons' => array('approved' => array('label' => 'Approved', 'url' => 'Yii::app()->createUrl("/m1/aApprovalForm/updateApproved", array("id"=>$data->id))', 'visible' => '(!isset($data->approved_date))', 'options' => array('class' => 'btn btn-mini', 'ajax' => array('type' => 'GET', 'url' => "js:\$(this).attr('href')", 'success' => 'js:function(data){$("#mydialog").dialog("open"); $.fn.yiiGridView.update("aPorder-grid", { data: $(this).serialize() }); }'))), 'payment' => array('label' => 'Paid', 'url' => 'Yii::app()->createUrl("/m1/aApprovalForm/updatePaid", array("id"=>$data->id))', 'visible' => '(isset($data->approved_date)) && (!isset($data->payment_date))', 'options' => array('class' => 'btn btn-mini', 'ajax' => array('type' => 'GET', 'url' => "js:\$(this).attr('href')", 'success' => 'js:function(data){$("#mydialog").dialog("open"); $.fn.yiiGridView.update("aPorder-grid", { data: $(this).serialize() }); }'))))), array('class' => 'BootButtonColumn', 'template' => '{print}', 'buttons' => array('print' => array('label' => 'Print AF ', 'url' => 'Yii::app()->createUrl("/m1/aApprovalForm/report1", array("id"=>$data->id))', 'visible' => '(!isset($data->approved_date))', 'options' => array('class' => 'btn btn-mini')))), array('class' => 'BootButtonColumn', 'template' => '{budgetposition}', 'buttons' => array('budgetposition' => array('label' => ' Budget Position', 'url' => 'Yii::app()->createUrl("/m1/aApprovalForm/report2", array("id"=>$data->id))', 'visible' => '(!isset($data->approved_date))', 'options' => array('class' => 'btn btn-mini')))), array('header' => 'Budget Project', 'name' => 'organization.getparent.getparent.name'), 'input_date', array('name' => 'no_ref', 'type' => 'raw', 'value' => 'CHtml::link($data->no_ref,Yii::app()->createUrl("/m1/aApprovalForm/view",array("id"=>$data->id)))'), 'periode_date', array('header' => 'BudgetComp', 'value' => 'isset($data->budgetcomp) ? $data->budgetcomp->name : "!!!ERROR CONTACT PETER!!!"'), 'remark', array('header' => 'Total', 'value' => '$data->sum_pof()', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), array('class' => 'BootButtonColumn', 'template' => '{myView}', 'buttons' => array('myView' => array('label' => '<i class="icon-zoom-in"></i>', 'url' => '$this->grid->controller->createUrl("/m1/aApprovalForm/view", array("id"=>$data->id,"asDialog"=>1,"gridId"=>$this->grid->id))', 'click' => 'function(){$("#cru-frame").attr("src",$(this).attr("href")); $("#cru-dialog").dialog("open"); return false;}')))))); ?> <?php //--------------------- begin new code -------------------------- // add the (closed) dialog for the iframe $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'cru-dialog', 'options' => array('title' => 'View Detail', 'autoOpen' => false, 'modal' => true, 'width' => '70%', 'height' => '400'))); ?> <iframe id="cru-frame" width="100%" height="100%"></iframe> <?php $this->endWidget(); //--------------------- end new code -------------------------- $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'mydialog', 'options' => array('title' => 'Process', 'autoOpen' => false, 'modal' => true))); echo 'Process Complete...'; $this->endWidget('zii.widgets.jui.CJuiDialog');