navigation  interaction  search

 other resources

Changeset 409

Show
Ignore:
Timestamp:
06/02/08 17:43:58
Author:
nate
Message:
  • Fixed order of items on client statement report.
  • Fixed days past due with paid ar items.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phpbms/modules/bms/report/aritems_clientstatement.php

    r396 r409  
    5858                else 
    5959                        $this->statementDate = mktime(0,0,0); 
    60                         
     60                 
    6161                $this->showPayments = $showPayments;                     
    6262                $this->showClosed = $showClosed; 
    63                         
    64         }//end method 
     63                 
     64        }//end method aritemsClientStatements 
    6565         
    6666         
    6767        function generate($whereclause = ""){ 
    68          
    69  
     68                
     69                 
    7070                if($whereclause) 
    7171                        $this->whereclause = $whereclause; 
     
    7575                                aritems.status = 'open' 
    7676                                AND aritems.posted = 1"; 
    77  
    78  
     77                 
     78                 
    7979                //first we need to get the list of clients.                              
    8080                $querystatement = " 
     
    110110                 
    111111                $querystatement = $this->assembleSQL($querystatement); 
    112  
     112                 
    113113                $clientresult = $this->db->query($querystatement); 
    114          
     114                
    115115                if(!class_exists("phpbmsPDFReport")) 
    116116                        include("report/pdfreport_class.php"); 
    117                                         
     117                         
    118118                $this->pdf = new phpbmsPDFReport($this->db, "P","in","Letter"); 
    119                                 
     119                 
    120120                $pdf = &$this->pdf; 
    121  
     121                 
    122122                $this->itemColumns = array( 
    123123                        array("field" => "itemdate", "title" => "date", "size" => 1, "align" => "L", "nl" => 0), 
     
    130130                 
    131131                $this->itemColumns[4]["size"] = $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - 5; 
    132  
     132                 
    133133                //uncomment the following line to help troubleshoot formatting 
    134134                //$pdf->borderDebug = 1; 
    135135                $pdf->hasComapnyHeader = true; 
    136136                $pdf->SetMargins(); 
    137                                 
     137                 
    138138                while($clientrecord = $this->db->fetchArray($clientresult)){ 
    139139                         
     
    141141                         
    142142                        $this->clientrecord = $clientrecord; 
    143                  
     143                        
    144144                        $this->_addPage(); 
    145145                         
    146146                        $this->_addItems(); 
    147  
     147                         
    148148                        //footer 
    149149                        $pdf->setXY($pdf->leftmargin, 8.5 + $pdf->topmargin); 
     
    159159                        $pdf->SetX($pdf->GetX()+.02);                                    
    160160                        $pdf->Cell(1 - 0.02, 0.17, "Total Due", 1, 2, "R", 1); 
    161  
     161                         
    162162                        $pdf->SetX($pdf->leftmargin);    
    163163                         
     
    177177                        $this->term2Total = 0; 
    178178                        $this->term3Total = 0; 
    179  
     179                         
    180180                }//end while             
    181181                 
     
    353353                                aritems 
    354354                        WHERE 
    355                                 posted =
     355                                posted =
    356356                                AND clientid = ".((int) $this->clientrecord["clientid"]); 
    357357 
     
    401401                                        }//end if 
    402402                                         
    403                                         $therecord["dayspd"] = $daysover; 
     403                                        if($therecord["due"] > 0) 
     404                                                $therecord["dayspd"] = $daysover; 
     405                                        else 
     406                                                $therecord["dayspd"] = "(paid in full)"; 
    404407                                         
    405408                                }//endif 
    406409                                 
     410                                $keydate = $therecord["itemdate"]; 
    407411                                $therecord["itemdate"] = formatFromSQLDate($therecord["itemdate"]); 
    408412                                $therecord["amount"] = formatVariable($therecord["amount"], "currency"); 
     
    410414                                $therecord["due"] = formatVariable($therecord["due"], "currency"); 
    411415                                 
    412                                 $returnArray[$therecord["itemdate"]."-".$therecord["id"]] = $therecord; 
     416                                $returnArray[$keydate."-".$therecord["id"]] = $therecord; 
    413417                                 
    414418                        }//end if 
     
    467471                 
    468472                ksort($returnArray); 
    469  
     473                 
    470474                return $returnArray; 
    471475 
     
    566570                 
    567571                $this->showPayments = isset($variables["showpayments"]); 
    568                         
     572                 
    569573                if(!isset($variables["selrecords"])) 
    570574                        $variables["selrecords"] = "allOpen"; 
    571                         
     575                 
    572576                switch($variables["selrecords"]){ 
    573                  
     577                        
    574578                        case "allOpen": 
    575579                                $this->generate(); 
     
    584588                                $this->generate();       
    585589                                break; 
    586                  
     590                        
    587591                }//endswitch 
    588592                 
Copyright © 2006-2007 Kreotek, LLC. All Rights reserved.