コード例 #1
0
ファイル: GlDistDetails.php プロジェクト: ranvijayj/htmlasa
    public static function getAPDists($apId)
    {
        $dists= GlDistDetails::model()->findAllByAttributes(array(
            'AP_ID' => $apId,
        ));
        $i=0;
        if($dists){
            foreach ($dists as $dist) {

                $return_array[$i]['GL_Dist_Detail_COA_Acct_Number']=$dist->GL_Dist_Detail_COA_Acct_Number;
                $return_array[$i]['Short_Hand']=$dist->Short_Hand;
                $return_array[$i]['GL_Dist_Detail_Desc']=$dist->GL_Dist_Detail_Desc;
                $return_array[$i]['GL_Dist_Detail_Amt']=$dist->GL_Dist_Detail_Amt;

                $i++;

            }
            for($i = count($return_array); $i < 4; $i++) {
                $return_array[$i] = array(
                    'GL_Dist_Detail_COA_Acct_Number' => '',
                    'Short_Hand'=>'',
                    'GL_Dist_Detail_Desc' => '',
                    'GL_Dist_Detail_Amt' => '',
                );

            }
        $empty =false;
        } else {
            for($i = 1; $i <= 4; $i++) {
                $return_array[$i] = array(
                    'GL_Dist_Detail_COA_Acct_Number' => '',
                    'Short_Hand'=>'',
                    'GL_Dist_Detail_Desc' => '',
                    'GL_Dist_Detail_Amt' => '',
                );

            }
        $empty =true;
        }
        return array('empty'=>$empty,'dists'=>$return_array);
    }
コード例 #2
0
ファイル: Aps.php プロジェクト: ranvijayj/htmlasa
    /**
     * Delete AP with rows in relative tables
     * @param $apId
     */
    public static function deleteAP($apId)
    {
        $ap = Aps::model()->with('document.image')->findByPk($apId);
        if ($ap) {
            $document = $ap->document;
            $image = $document->image;
            $image->delete();
            $document->delete();

            ApPayments::model()->deleteAllByAttributes(array(
                'AP_ID' => $apId,
            ));

            GlDistDetails::model()->deleteAllByAttributes(array(
                'AP_ID' => $apId,
            ));

            // delete thumbnail
            $filePath = 'protected/data/thumbs/' . $ap->Document_ID . '.jpg';
            if (file_exists($filePath)) {
                @unlink($filePath);
            }

            // delete library links
            LibraryDocs::deleteDocumentLinks($ap->Document_ID);

            $ap->delete();
        }
    }