示例#1
0
        case 161100:
            $satker = DaftarUnit::find()->where('unit_id in (0)')->all();
            break;
        case 151000:
            $satker = DaftarUnit::find()->where('unit_id=0')->all();
            break;
        default:
            echo "";
    }
    foreach ($satker as $sat) {
        ?>
                        <tr>
                            <th  width="240" bgcolor="gray" align="left">
                                <div class="pull-right">
                                    <?php 
        echo HelperUnit::unit($sat->unit_id);
        ?>
   
                                </div>

                            </th>
                            <td align="center"><?php 
        $sql_pagu = "SELECT sum(b.alokasi_sub_mak) FROM serasi2015_sql.news_nas_suboutput a LEFT JOIN serasi2015_sql.news_sub_mak_tahun b on a.suboutput_id=b.sub_mak_id LEFT JOIN pegawai.daf_unit c on a.unit_id3=c.unit_id WHERE a.tahun=" . $tahun . " and c.unit_id=" . $sat['unit_id'];
        $nilaipagu = Yii::$app->db->createCommand($sql_pagu)->queryScalar();
        $pagn = number_format($nilaipagu, 0, ",", ".");
        echo $pagn;
        ?>
   
                             </td>
                            <td align="center">
                            	<?php 
示例#2
0
            $jum = Yii::$app->db->createCommand("SELECT \n                                      sum(alokasi_sub_mak) as total\n                                     FROM pagu_mak where  unit_id in(131000,132000,133000)")->queryScalar();
            break;
    }
    $n = 1;
    foreach ($satker as $sat) {
        $ese = isset($_GET['unit_id']) ? $_GET['unit_id'] : $sat->unit_id;
        $hsl = Yii::$app->db->createCommand("SELECT \n                                      sum(alokasi_sub_mak) as total\n                                     FROM pagu_mak where  unit_id in(" . $ese . ")")->queryScalar();
        ?>

                        <tr >
                            <td align="right"><?php 
        echo $n;
        ?>
.</td>
                            <td><?php 
        echo \common\components\HelperUnit::unit($sat->unit_id);
        ?>
</td>
                            <td align="center"><?php 
        $pag = HelperUnit::Pagu($sat->unit_id);
        $pagn = number_format(HelperUnit::Pagu($sat->unit_id), 0, ",", ".");
        echo $pagn;
        ?>
   
                            </td>
                            <?php 
        for ($i = 1; $i < 13; $i++) {
            if ($i < 10) {
                $a = '0' . $i;
            } else {
                $a = $i;