<?php

/**
 * Product:     Loyalty Program for Enterprise Edition
 * Package:     Aitoc_Aitloyalty_10.0.10_574534
 * Purchase ID: INzRIwyyaNoeOLERhAgt4U28qVKIeEa3dfPrgaAN3C
 * Generated:   2013-05-13 06:36:55
 * File path:   app/code/local/Aitoc/Aitloyalty/Model/Rewrite/FrontSalesQuoteAddressTotalDiscount.php
 * Copyright:   (c) 2013 AITOC, Inc.
 */
if (Aitoc_Aitsys_Abstract_Service::initSource(__FILE__, 'Aitoc_Aitloyalty')) {
    rSDejjrQVBrENgRV('e979e89f9599e9b937209393b31aff58');
    /**
     * @copyright  Copyright (c) 2009 AITOC, Inc. 
     */
    class Aitoc_Aitloyalty_Model_Rewrite_FrontSalesQuoteAddressTotalDiscount extends Mage_Sales_Model_Quote_Address_Total_Discount
    {
        public function fetch(Mage_Sales_Model_Quote_Address $address)
        {
            $amount = $address->getDiscountAmount();
            if ($amount != 0) {
                if ($amount > 0) {
                    $title = Mage::helper('sales')->__('Discount');
                } else {
                    $title = Mage::helper('sales')->__('Surcharge');
                }
                if ($code = $address->getCouponCode()) {
                    if ($amount > 0) {
                        $title = Mage::helper('sales')->__('Discount (%s)', $code);
                    } else {
                        $title = Mage::helper('sales')->__('Surcharge (%s)', $code);
<?php

/**
 * Product:     Loyalty Program for Enterprise Edition
 * Package:     Aitoc_Aitloyalty_10.0.10_574534
 * Purchase ID: INzRIwyyaNoeOLERhAgt4U28qVKIeEa3dfPrgaAN3C
 * Generated:   2013-05-13 06:36:55
 * File path:   app/code/local/Aitoc/Aitloyalty/Model/Rewrite/FrontSalesOrderPdfCreditmemo.php
 * Copyright:   (c) 2013 AITOC, Inc.
 */
if (Aitoc_Aitsys_Abstract_Service::initSource(__FILE__, 'Aitoc_Aitloyalty')) {
    rSDejjrQVBrENgRV('eb01aa0284d9e4fe0de7778bb3ec3ba4');
    /**
     * @copyright  Copyright (c) 2009 AITOC, Inc. 
     */
    class Aitoc_Aitloyalty_Model_Rewrite_FrontSalesOrderPdfCreditmemo extends Mage_Sales_Model_Order_Pdf_Creditmemo
    {
        protected function insertTotals($page, $source)
        {
            $order = $source->getOrder();
            //        $font = $this->_setFontBold($page);
            $totals = $this->_getTotalsList($source);
            $lineBlock = array('lines' => array(), 'height' => 15);
            foreach ($totals as $total) {
                $amount = $source->getDataUsingMethod($total['source_field']);
                $displayZero = isset($total['display_zero']) ? $total['display_zero'] : 0;
                if ($amount != 0 || $displayZero) {
                    // AITOC modifications
                    if ('discount_amount' == $total['source_field']) {
                        $amount = 0 - $amount;
                        if ($amount > 0) {