Exemple #1
0
                    <span class="description"><?php 
        echo FiInvoiceDetail::fnBuildDescription($mDetail);
        ?>
</span>
                    <?php 
        $display_none = 'display_none';
        $total_amount_due += $mDetail->amount;
        if ($key) {
            $display_none = '';
        }
        $next = Yii::app()->createAbsoluteUrl('admin/fiInvoice/create', array('row_number' => $key + 1));
        ?>
                </td>
                <td class="l_padding_10 w-150 item_r">
                    <?php 
        echo MyFormat::formatPrice($mDetail->amount);
        ?>
                </td>
            </tr>                    
            <?php 
    }
    ?>
            <?php 
}
?>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="2" class="item_r item_b">
                    Total Amount Due
                </td>
Exemple #2
0
                            <?php 
            echo MyFormat::formatPrice($revenue);
            ?>
                        </td>
                    </tr>
                    <?php 
        }
        ?>
                <?php 
    }
    ?>
            <?php 
}
?>
        </tbody>
        <tfoot class="display_none">
            <tr>
                <td class="item_c item_b">Total</td>
                <td class="item_r item_b"><?php 
echo number_format($total_trans, 0);
?>
</td>
                <td class="item_r item_b"><?php 
echo MyFormat::formatPrice($total_revenue);
?>
</td>
            </tr>
        </tfoot>

    </table>
</div>
Exemple #3
0
 public static function getViewDetailOfficialBank($model)
 {
     $res = MyFormat::formatPrice($model->office_bkank_valuation);
     return $res;
 }
Exemple #4
0
         return $date->format(CmsFormatter::$dateTranFormat . ' ' . Yii::app()->params['timeFormat']);
     }
     return parent::formatDate($value);
 }
 public function formatFileSize($value)
Exemple #5
0
 public static function ReportTrans()
 {
     Yii::import('application.extensions.vendors.PHPExcel', true);
     $objPHPExcel = new PHPExcel();
     // Set properties
     $objPHPExcel->getProperties()->setCreator("ANHDUNG")->setLastModifiedBy("ANHDUNG")->setTitle('Report Financial')->setSubject("Office 2007 XLSX Document")->setDescription("Report Transaction")->setKeywords("office 2007 openxml php")->setCategory("Report Transaction");
     $row = 1;
     $i = 1;
     //        $dataAll = $_SESSION['data-excel']->data;
     $HeadTitle = 'Report Transaction';
     $TOTAL_AMOUNT_INVOICE = isset($_SESSION['REPORT_TRANSACTION']['TOTAL_AMOUNT_INVOICE']) ? $_SESSION['REPORT_TRANSACTION']['TOTAL_AMOUNT_INVOICE'] : array();
     $TOTAL_AMOUNT_VOUCHER = isset($_SESSION['REPORT_TRANSACTION']['TOTAL_AMOUNT_VOUCHER']) ? $_SESSION['REPORT_TRANSACTION']['TOTAL_AMOUNT_VOUCHER'] : array();
     $COUNT_TRANS = isset($_SESSION['REPORT_TRANSACTION']['COUNT_TRANS']) ? $_SESSION['REPORT_TRANSACTION']['COUNT_TRANS'] : array();
     $LOOP_VAR = isset($_SESSION['REPORT_TRANSACTION']['LOOP_VAR']) ? $_SESSION['REPORT_TRANSACTION']['LOOP_VAR'] : array();
     $total_trans = 0;
     $total_revenue = 0;
     $cmsFormater = new CmsFormatter();
     $REPORT_TYPE = $_SESSION['REPORT_TYPE'];
     // 1.sheet 1
     $objPHPExcel->setActiveSheetIndex(0);
     $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setName('Times New Roman');
     $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(12);
     $objPHPExcel->getActiveSheet()->setTitle($HeadTitle);
     $objPHPExcel->getActiveSheet()->setCellValue("A{$row}", FiInvoice::$STA_REPORT_TYPE[$REPORT_TYPE]);
     $objPHPExcel->getActiveSheet()->getStyle("A{$row}")->getFont()->setBold(true);
     $objPHPExcel->getActiveSheet()->mergeCells("A{$row}:c{$row}");
     $row++;
     $index = 1;
     $beginBorder = $row;
     $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", 'Date');
     $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", 'Number of Transactions');
     $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", 'Revenue');
     $index--;
     $objPHPExcel->getActiveSheet()->getStyle("A{$row}:" . MyFormat::columnName($index) . $row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle("A{$row}:" . MyFormat::columnName($index) . $row)->getFont()->setBold(true);
     $row++;
     if ($REPORT_TYPE == FiInvoice::REPORT_DAILY) {
         foreach ($LOOP_VAR as $value) {
             $amount_invoice = isset($TOTAL_AMOUNT_INVOICE[$value]) ? $TOTAL_AMOUNT_INVOICE[$value] : 0;
             $amount_voucher = isset($TOTAL_AMOUNT_VOUCHER[$value]) ? $TOTAL_AMOUNT_VOUCHER[$value] : 0;
             $revenue = $amount_invoice - $amount_voucher;
             $total_trans += isset($COUNT_TRANS[$value]) ? $COUNT_TRANS[$value] : 0;
             $total_revenue += $revenue;
             if ($revenue != 0 || $amount_invoice != 0 || $amount_voucher != 0) {
                 $index = 1;
                 $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", MyFormat::dateConverYmdToDmy($value, "d/m/Y"));
                 $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", $COUNT_TRANS[$value]);
                 $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", MyFormat::formatPrice($revenue));
                 $row++;
                 $i++;
             }
         }
         // end foreach($LOOP_VAR
     } elseif ($REPORT_TYPE == FiInvoice::REPORT_MONTHLY) {
         foreach ($LOOP_VAR as $year => $arrMonth) {
             foreach ($arrMonth as $month => $temp) {
                 $amount_invoice = isset($TOTAL_AMOUNT_INVOICE[$year][$month]) ? $TOTAL_AMOUNT_INVOICE[$year][$month] : 0;
                 $amount_voucher = isset($TOTAL_AMOUNT_VOUCHER[$year][$month]) ? $TOTAL_AMOUNT_VOUCHER[$year][$month] : 0;
                 $revenue = $amount_invoice - $amount_voucher;
                 $total_trans += isset($COUNT_TRANS[$year][$month]) ? $COUNT_TRANS[$year][$month] : 0;
                 $total_revenue += $revenue;
                 if ($revenue != 0 || $amount_invoice != 0 || $amount_voucher != 0) {
                     $index = 1;
                     $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", "{$month}/{$year}");
                     $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", $COUNT_TRANS[$year][$month]);
                     $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", MyFormat::formatPrice($revenue));
                     $row++;
                     $i++;
                 }
             }
             // foreach($arrMonth as $month=>$temp):
         }
         // end foreach($LOOP_VAR
     } elseif ($REPORT_TYPE == FiInvoice::REPORT_YEARLY) {
         foreach ($LOOP_VAR as $year => $tmp) {
             $amount_invoice = isset($TOTAL_AMOUNT_INVOICE[$year]) ? $TOTAL_AMOUNT_INVOICE[$year] : 0;
             $amount_voucher = isset($TOTAL_AMOUNT_VOUCHER[$year]) ? $TOTAL_AMOUNT_VOUCHER[$year] : 0;
             $revenue = $amount_invoice - $amount_voucher;
             $total_trans += isset($COUNT_TRANS[$year]) ? $COUNT_TRANS[$year] : 0;
             $total_revenue += $revenue;
             if ($revenue != 0 || $amount_invoice != 0 || $amount_voucher != 0) {
                 $index = 1;
                 $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", $year);
                 $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", $COUNT_TRANS[$year]);
                 $objPHPExcel->getActiveSheet()->setCellValue(MyFormat::columnName($index++) . "{$row}", MyFormat::formatPrice($revenue));
                 $row++;
                 $i++;
             }
         }
         // end foreach($LOOP_VAR
     }
     //        $objPHPExcel->getActiveSheet()->getStyle("B$beginBorder:".MyFormat::columnName($index).($row))
     //            ->getAlignment()->setWrapText(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
     $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(25);
     $row--;
     $index--;
     $objPHPExcel->getActiveSheet()->getStyle("A{$beginBorder}:A" . $row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle("B{$beginBorder}:B" . $row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
     $objPHPExcel->getActiveSheet()->getStyle("C{$beginBorder}:C" . $row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
     $objPHPExcel->getActiveSheet()->getStyle("A{$beginBorder}" . ':' . MyFormat::columnName($index) . $row)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle("A{$beginBorder}:" . MyFormat::columnName($index) . $row)->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
     //save file
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     for ($level = ob_get_level(); $level > 0; --$level) {
         @ob_end_clean();
     }
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Pragma: public');
     header('Content-type: ' . 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment; filename="' . 'Report Transaction.' . 'xlsx' . '"');
     header('Cache-Control: max-age=0');
     $objWriter->save('php://output');
     Yii::app()->end();
 }
Exemple #6
0
 /**
  * @Author: ANH DUNG Jun 27, 2014
  * @Todo: format price min max of this property
  * @Param: $model
  * @Return: string
  */
 public static function formatPriceMinMax($model, $fieldName)
 {
     $price = MyFormat::formatPrice($model->{$fieldName});
     if ($model->price_sign_position == ProPropertyType::P_BEFORE) {
         $price = "{$model->price_sign}" . $price;
     } else {
         $price = $price . "{$model->price_sign}";
     }
     return $price;
 }