Exemplo n.º 1
0
 public static function getDataWithWithVoucherID($voucher_id, $type = null)
 {
     $data = FiPaymentVoucherDetail::model()->findAllByAttributes(array('voucher_id' => $voucher_id));
     $json = '';
     if ($data && count($data) > 0) {
         foreach ($data as $itemDetail) {
             $attributes = $itemDetail->attributes;
             $json[] = json_encode($attributes);
         }
         if ($type == null) {
             if (count($json) > 0) {
                 $json = implode(',', $json);
             }
         }
     }
     return $json;
 }
Exemplo n.º 2
0
 public function actionDeleteVoucher($id)
 {
     // dung ham nay de load model
     $model = MyFormat::loadModelByClass($id, 'FiPaymentVoucher');
     if ($model) {
         FiPaymentVoucherDetail::model()->deleteAllByAttributes(array('voucher_id' => $model->id));
         $model->delete();
     }
 }