phpBMS

Show
Ignore:
Timestamp:
12/31/09 13:36:45 (2 years ago)
Author:
brieb
Message:
  • Introduced administratively changeable settings to indvidual reports
  • Modified all reports to work with new settings system
  • Altered invoice and line item total reports to accept parameters from reportsettings: You can now bypass the grouping/column dialog by providing the infrmation administratively
  • Altered all sales order PDF reports to accept parameters from reportsettings: You can now administratively change certain aspects of the print outs, including what parts of the top of the report to show, and what to title the report
  • Altered label reports to accept parameters from reportsettings: printed data as well

as label measurements and layout are now defined by administratively

  • Altered export and tableprint reports to accept parameters from reportsettings: You can specify individual columns and from table instead of just the defaults (all fields, main table only)
  • Added var_dump-esque 'debug' function for development purposes to common functions
  • Integrated FPDI functionality with sales order PDF reports: It is now possible to use a PDF saved in the files table as a background template for your invoices (e.g. watermarks)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/modules/bms/report/invoices_pdfquote.php

    r673 r693  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
    39 if(!isset($_SESSION["userinfo"]["id"])){ 
    40  
    41         //IE needs caching to be set to private in order to display PDFS 
    42         session_cache_limiter('private'); 
    43  
    44         //set encoding to latin1 (fpdf doesnt like utf8) 
    45         $sqlEncoding = "latin1"; 
    46         require_once("../../../include/session.php"); 
    47  
    48 }//end if 
    49  
    5039if(!class_exists("invoicePDF")) 
    51         include("invoices_pdf_class.php"); 
     40    include("invoices_pdf_class.php"); 
    5241 
    5342class  quotePDF extends invoicePDF{ 
    5443 
    55         var $title = "Quote"; 
     44    function quotePDF($db, $reportUUID, $tabledefUUID, $orientation='P', $unit='mm', $format='Letter'){ 
    5645 
    57         function quotePDF($db, $orientation='P', $unit='mm', $format='Letter'){ 
     46        $this->invoicePDF($db, $reportUUID, $tabledefUUID, $orientation, $unit, $format); 
    5847 
    59                 $this->invoicePDF($db, $orientation, $unit, $format); 
     48    }//end method 
    6049 
    61         }//end method 
    6250 
    63         function initialize(){ 
    64                 parent::initialize(); 
     51    /** 
     52     * function checkForDefaultSettings 
     53     * 
     54     * Checks to make sure loaded report Settings exist and are correct 
     55     */ 
     56    function checkForDefaultSettings(){ 
    6557 
    66                 unset($this->totalsinfo[5]); 
     58        if(!isset($this->settings["reportTitle"])) 
     59            $this->settings["reportTitle"] = "Quote"; 
    6760 
    68         }//end method 
     61        parent::checkForDefaultSettings(); 
     62 
     63    }//end function checkForDefaultSettings 
     64 
     65 
     66    function initialize(){ 
     67 
     68        parent::initialize(); 
     69 
     70        unset($this->totalsinfo[5]); 
     71 
     72    }//end method 
     73 
     74 
     75    /** 
     76     * function addingRecordDefaultSettings 
     77     * 
     78     * Creates an array of settings associative arrays for use by the system when 
     79     * a new report record is added that references the file containing this class 
     80     * 
     81     * @retrun array of settings. Each setting should itself be 
     82     * an associative array containing the following 
     83     * name: name of the setting 
     84     * defaultvalue: default value for setting 
     85     * type: (string, int, real, bool) type for value of setting 
     86     * required: (0,1) whether the setting is required or not 
     87     * description: brief description for what this setting is used for. 
     88     */ 
     89    function addingRecordDefaultSettings(){ 
     90 
     91        $settings = parent::addingRecordDefaultSettings(); 
     92 
     93        for($i=0; $i< count($settings); $i++){ 
     94 
     95            switch($settings[$i]["name"]){ 
     96 
     97                case "reportTitle": 
     98                    $settings[$i]["defaultValue"] = "Quote"; 
     99 
     100            }//endswitch 
     101 
     102        }//end foreach 
     103 
     104        return $settings; 
     105 
     106    }//endfunction addingRecordDefaultSettings 
    69107 
    70108}//end class 
    71109 
    72 //PROCESSING 
    73 //============================================================================= 
     110 
     111/** 
     112 * PROCESSING 
     113 * ============================================================================= 
     114 */ 
    74115if(!isset($noOutput)){ 
    75116 
    76         $report = new quotePDF($db, 'P', 'in', 'Letter'); 
    77         $report->showShipNameInShipTo = false; 
     117    //IE needs caching to be set to private in order to display PDFS 
     118    session_cache_limiter('private'); 
    78119 
    79         $report->setupFromPrintScreen(); 
    80         $report->generate(); 
    81          
    82         $filename = "Quote"; 
    83         if($report->count === 1){ 
    84                  
    85                 if($report->invoicerecord["company"]) 
    86                         $filename .= "_".$report->invoicerecord["company"]; 
    87                  
    88                 $filename .= "_".$report->invoicerecord["id"]; 
    89                  
    90         }elseif((int)$report->count) 
    91                 $filename .= "_Multiple"; 
    92          
    93         $filename .= ".pdf"; 
    94          
    95         $report->output('screen', $filename); 
     120    //set encoding to latin1 (fpdf doesnt like utf8) 
     121    $sqlEncoding = "latin1"; 
     122    require_once("../../../include/session.php"); 
     123 
     124    checkForReportArguments(); 
     125 
     126    $report = new quotePDF($db, $_GET["rid"], $_GET["tid"], 'P', 'in', 'Letter'); 
     127    $report->showShipNameInShipTo = false; 
     128 
     129    $report->setupFromPrintScreen(); 
     130    $report->generate(); 
     131 
     132    $filename = "Quote"; 
     133    if($report->count === 1){ 
     134 
     135        if($report->invoicerecord["company"]) 
     136            $filename .= "_".$report->invoicerecord["company"]; 
     137 
     138        $filename .= "_".$report->invoicerecord["id"]; 
     139 
     140    }elseif((int)$report->count) 
     141        $filename .= "_Multiple"; 
     142 
     143    $filename .= ".pdf"; 
     144 
     145    $report->output('screen', $filename); 
    96146 
    97147}//end if 
    98148 
    99149 
     150/** 
     151 * When adding a new report record, the add/edit needs to know what the class 
     152 * name is so that it can instantiate it, and grab it's default settings. 
     153 */ 
     154if(isset($addingReportRecord)) 
     155    $reportClass ="quotePDF"; 
    100156?> 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.