navigation  interaction  search

 other resources

Changeset 375

Show
Ignore:
Timestamp:
01/29/08 18:01:42
Author:
brieb
Message:
  • Implemented new search scheme for choosing clients on sales orders.
  • Added ability for prospects to create quotes.
  • Fixed issues with new prospects having credit limit.
  • Added basic update structure for 0.94
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phpbms/common/stylesheet/mozilla/forms.css

    r319 r375  
    9898.buttonDownload{background:url(image/button-download.png) 0 0 no-repeat;} 
    9999 
     100.buttonSpinner{ 
     101        cursor:auto; 
     102        background:url("../../image/spinner.gif") 0 0 no-repeat; 
     103} 
     104 
    100105.buttonShowSQLUp{width:35px;background:url(image/button-sql-up.png) 0 0 no-repeat;} 
    101106.buttonShowSQLDown{width:35px;background:url(image/button-sql-down.png) 0 0 no-repeat;} 
  • trunk/phpbms/common/stylesheet/mozilla/pages/invoice.css

    r356 r375  
    22/* $LastChangedDate$ */ 
    33 
    4 /* The following lines is put in  until the site is reformatted*/ 
    5 LABEL{display:inline;margin:0;padding:0} 
    6 DIV{padding:0;margin:0;} 
    7 P,.fauxP{margin:0;padding:0 5px 10px;} 
    8 .alt{display:none;} 
    9 .bodyline{display:block} 
    10 /* The following lines is put in  until the site is reformatted*/ 
     4#clientdisplay{ 
     5        background-image:url("../image/search.gif"); 
     6        background-repeat:no-repeat; 
     7        background-position:left; 
     8        padding-left:17px; 
     9
     10 
     11#clientSearchBox{ 
     12        border:1px solid #999999; 
     13        background:white; 
     14        width:300px; 
     15        position:absolute; 
     16
     17 
     18#CSBResults{ 
     19 overflow:auto; 
     20
     21 
     22#CSBResults DIV{ 
     23         color:#666666; 
     24         padding:5px; 
     25         font-style:italic; 
     26
     27 
     28#CSBResults A{ 
     29        width:245px;/* 295 - 5 - 30 */ 
     30        display:block; 
     31        color:#663366; 
     32        font-weight:normal; 
     33        padding:5px 3px 5px 30px; 
     34        background-repeat:no-repeat; 
     35        background-position:8px 8px; 
     36
     37 
     38#CSBResults A:hover, #CSBResults A.CSBSelected{ 
     39        text-decoration:none; 
     40        background-color:#663366; 
     41        color:white; 
     42
     43 
     44#CSBAddNewButton{ 
     45        width:70px; 
     46        text-align:right; 
     47
     48 
     49.client{ 
     50        background-image:url("../image/client.png"); 
     51
     52 
     53.prospect{ 
     54        background-image:url("../image/prospect.png"); 
     55
     56 
     57#CSBResults SPAN{ 
     58        display:block; 
     59
     60 
     61.CSBMain{ 
     62        font-weight:bold; 
     63
     64 
     65.CSBExtra{ 
     66        font-size:9px; 
     67
     68 
     69#CSBHeader{ 
     70        background:#EEEEEE; 
     71        text-align:right;        
     72        padding:5px; 
     73        height:16px; 
     74
     75 
     76#CSBFooter{ 
     77        background:#EEEEEE; 
     78        text-align:right; 
     79        font-size:10px; 
     80        padding:5px; 
     81
    1182 
    1283#h1WithPrint{margin-right:230px;} 
  • trunk/phpbms/install/modules.sql

    r328 r375  
    1 INSERT INTO modules VALUES (1,'Base','base','The basic phpBMS framkework.  This is the minimum module required in order for the web applicatoin to work.','0.9'); 
     1INSERT INTO modules VALUES (1,'Base','base','The basic phpBMS framkework.  This is the minimum module required in order for the web applicatoin to work.','0.94'); 
  • trunk/phpbms/install/updatexml.php

    r357 r375  
    274274                                        break; 
    275275 
     276                                // ================================================================================================ 
     277                                case "0.92":                             
     278                                        $thereturn .= "Updating phpBMS Core to 0.94\n"; 
     279                                         
     280                                        //Processing Data Structure Changes 
     281                                        $thereturn .= processSQLfile($db,"updatev0.94.sql"); 
     282                                 
     283                                        //Updating Module Table 
     284                                        $querystatement = " 
     285                                                UPDATE  
     286                                                        modules  
     287                                                SET  
     288                                                        version='0.94' 
     289                                                WHERE 
     290                                                        name='base'"; 
     291                                                         
     292                                        $queryresult = $db->query($querystatement); 
     293 
     294                                        $thereturn .= "_______________________\n\n"; 
     295                                        $thereturn .= "Update to 0.94 Finished\n\n"; 
     296                                         
     297                                        $currentVersion = "0.94"; 
     298                                         
     299                                        break; 
     300 
    276301                        }//end switch 
    277302                }//end while 
  • trunk/phpbms/modules/bms/adminsettings.php

    r332 r375  
    1717                                $variables["default_hascredit"] = 0; 
    1818                 
     19                        if(!isset($variables["prospects_on_orders"])) 
     20                                $variables["prospects_on_orders"] = 0; 
     21 
    1922                        $variables["default_creditlimit"] = currencyToNumber($variables["default_creditlimit"]); 
    2023                        return $variables; 
     
    8184 
    8285                        $theinput = new inputField("term3_percentage",$therecord["term3_percentage"],"term 3 percentage",false,"real",4,4); 
    83                         $fields[] = $theinput;                   
     86                        $fields[] = $theinput; 
     87                         
     88                        $theinput = new inputCheckbox("prospects_on_orders",$therecord["prospects_on_orders"],"allow prospects on sales orders"); 
     89                        $fields[] = $theinput;                                                   
    8490 
    8591                        return $fields; 
     
    112118<fieldset> 
    113119        <legend>sales orders</legend> 
     120 
     121        <p><?php $theform->showField("prospects_on_orders");?></p> 
     122 
    114123        <p> 
    115124                <label for="invoice_default_printinstruc">default printed instructions</label><br/> 
    116125                <textarea id="invoice_default_printinstruc" name="invoice_default_printinstruc" cols="60" rows="3" ><?php echo $therecord["invoice_default_printinstruc"]?></textarea> 
    117126        </p> 
     127 
    118128        <p><?php $theform->showField("default_payment");?></p> 
    119129 
  • trunk/phpbms/modules/bms/include/clients.php

    r350 r375  
    5151                 
    5252                function getDefaults(){ 
     53 
    5354                        $therecord = parent::getDefaults(); 
    5455 
    5556                        $therecord["type"] = DEFAULT_CLIENTTYPE; 
     57                         
    5658                        if($therecord["type"] == "client") { 
    5759 
    58                                 $therecord["becameclient"] = dateToString(mktime()); 
     60                                $therecord["becameclient"] = dateToString(mktime(), "SQL"); 
    5961                                $therecord["hascredit"] = DEFAULT_HASCREDIT; 
    6062                                $therecord["creditlimit"] = DEFAULT_CREDITLIMIT; 
     
    6365                         
    6466                        $therecord["webaddress"] = "http://"; 
    65                  
    6667                         
    6768                        return $therecord; 
     
    7071         
    7172                function prepareVariables($variables){ 
     73                 
    7274                        if ($variables["webaddress"]=="http://")  
    7375                                $variables["webaddress"] = NULL; 
     
    7779                                 
    7880                        if($variables["type"] == "prospect"){ 
    79                          
    80                                 $therecord["hascredit"] = 0; 
    81                                 $therecord["creditlimit"] = 0;                  
     81 
     82                                $variables["hascredit"] = 0; 
     83                                $variables["creditlimit"] = 0; 
    8284                         
    8385                        }//end if 
    8486 
    8587                        return $variables; 
     88                         
    8689                }//end method 
    8790                 
     
    9295                         
    9396                        return parent::updateRecord($variables, $modifiedby); 
     97                         
    9498                }//end method 
    9599                 
     
    164168                 
    165169                        //passed variable is array of user ids to be revoked 
    166                         $whereclause = $this->buildWhereClause(); 
    167                          
    168                         $querystatement = "DELETE FROM clients where (".$whereclause.") and type=\"prospect\";"; 
    169                         $queryresult = $this->db->query($querystatement); 
     170                        $clientWhereClause = $this->buildWhereClause(); 
     171                                                 
     172                        //next get any quotes that we may have to delete 
     173                        $invoiceWhereClause = $this->buildWhereClause("clientid"); 
     174                        $invoicestatement = " 
     175                                SELECT 
     176                                        invoices.id 
     177                                FROM 
     178                                        invoices INNER JOIN clients ON invoices.clientid = clients.id 
     179                                WHERE 
     180                                        (".$invoiceWhereClause.") 
     181                                        AND clients.type='prospect'"; 
     182                                         
     183                        $invoiceresult = $this->db->query($invoicestatement); 
     184                         
     185                        //build invoice id array 
     186                        $invoiceids = array(); 
     187                        while($therecord = $this->db->fetchArray($invoiceresult)) 
     188                                $invoiceids[] = $therecord["id"]; 
     189                         
     190                        if(count($invoiceids)) { 
     191                                $invoiceWhereClause = $this->buildWhereClause("invoices.id", $invoiceids); 
     192                                 
     193                                $lineitemWhereClause = $this->buildWhereClause("invoiceid", $invoiceids); 
     194         
     195                                $lineItemDeleteStatement = " 
     196                                        DELETE FROM 
     197                                                lineitems 
     198                                        WHERE 
     199                                                ".$lineitemWhereClause; 
     200         
     201                                $queryresult = $this->db->query($lineItemDeleteStatement); 
     202         
     203                                $statushistoryDeleteStatement = " 
     204                                        DELETE FROM 
     205                                                invoicestatushistory 
     206                                        WHERE 
     207                                                ".$lineitemWhereClause; 
     208         
     209                                $queryresult = $this->db->query($statushistoryDeleteStatement); 
     210                                 
     211                                $invoiceDeleteStatement = " 
     212                                        DELETE FROM 
     213                                                invoices 
     214                                        WHERE                                    
     215                                                ".$invoiceWhereClause; 
     216 
     217                                $queryresult = $this->db->query($invoiceDeleteStatement); 
     218 
     219                        }//end if 
     220 
     221                        $deletestatement = " 
     222                                DELETE FROM  
     223                                        clients 
     224                                WHERE  
     225                                        (".$clientWhereClause.")  
     226                                        AND clients.type='prospect'"; 
     227                                         
     228                        $queryresult = $this->db->query($deletestatement); 
    170229                 
    171230                        $message = $this->buildStatusMessage(); 
    172231                        $message.=" deleted."; 
    173232                        return $message;         
    174                 } 
     233                         
     234                }// end method 
    175235                 
    176236                 
  • trunk/phpbms/modules/bms/include/invoices.php

    r362 r375  
    4040        class invoices extends phpbmsTable{ 
    4141         
     42                function showClientField($id){ 
     43                 
     44                        if($id){ 
     45                                 
     46                                $querystatement=" 
     47                                        SELECT  
     48                                                firstname, 
     49                                                lastname, 
     50                                                company, 
     51                                                type 
     52                                        FROM 
     53                                                clients 
     54                                        WHERE 
     55                                                id=".$id; 
     56 
     57                                $queryresult = $this->db->query($querystatement); 
     58                                 
     59                                $therecord = $this->db->fetchArray($queryresult); 
     60 
     61                                $display = $therecord["company"];                                
     62 
     63                                if($display){ 
     64                                         
     65                                        if($therecord["lastname"]) 
     66                                                $display .= " (".$therecord["lastname"].", ".$therecord["firstname"].")"; 
     67                                         
     68                                } else { 
     69                                 
     70                                        $display = $therecord["lastname"].", ".$therecord["firstname"]; 
     71                                 
     72                                }//endif 
     73                                 
     74                                 
     75                        }//endif 
     76                         
     77                 
     78                        ?> 
     79                                <input type="hidden" id="clientid" name="clientid"  <?php if($id) echo 'value="'.$id.'"'?> /> 
     80                                <input type="hidden" id="clienttype" name="clienttype"  <?php if($id) echo 'value="'.$therecord["type"].'"'?> /> 
     81                                <input type="text" id="clientdisplay" name="clientdisplay" size="51" <?php if($id) echo 'value="'.$display.'"'?> /> 
     82                                <button id="viewClientButton" type="button" title="view client" class="graphicButtons buttonInfo"><span>view client</span></button><?php  
     83                                                 
     84                }//end method 
     85                 
     86         
    4287                function updateStatus($invoiceid,$statusid,$statusdate,$assignedtoid){ 
    4388         
     
    130175                 
    131176                }//end function 
     177 
    132178                 
    133179                function displayStatusDropDown($statusid,$statuses){ 
     
    142188                                ?> 
    143189                        </select><?php 
    144                 }//end method 
     190 
     191                }//end method 
     192 
    145193                 
    146194                function getPayments($paymentmethodid){ 
     195 
    147196                        $querystatement=" 
    148197                                SELECT  
     
    180229                         
    181230                        return $thereturn; 
    182                 } 
     231 
     232                }//end function 
    183233         
    184234         
    185235                function showShippingSelect($id,$shippingMethods){ 
     236 
    186237                        ?><select name="shippingmethodid" id="shippingmethodid" onchange="changeShipping()"> 
    187238                                <option value="0" <?php if($id==0) echo "selected=\"selected\""?>>&lt;none&gt;</option> 
     
    191242                        </select> 
    192243                        <?php  
    193                 } 
     244 
     245                }//end function 
    194246         
    195247         
    196248                function getShipping($shippingmethodid){ 
    197                         $querystatement="SELECT id,name,canestimate,estimationscript FROM shippingmethods WHERE inactive=0 OR id=".((int) $shippingmethodid)." ORDER BY priority,name"; 
     249 
     250                        $querystatement=" 
     251                                SELECT  
     252                                        id, 
     253                                        name, 
     254                                        canestimate, 
     255                                        estimationscript 
     256                                FROM  
     257                                        shippingmethods  
     258                                WHERE  
     259                                        inactive=0 
     260                                        OR id=".((int) $shippingmethodid)."  
     261                                ORDER BY  
     262                                        priority, 
     263                                        name"; 
     264                                         
    198265                        $queryresult=$this->db->query($querystatement); 
    199266         
     
    214281 
    215282                        return $thereturn; 
    216                 } 
     283 
     284                }//end function 
    217285         
    218286         
    219287                function showTaxSelect($id){ 
     288 
    220289                        $id=(int) $id; 
    221290                        $querystatement="SELECT id,name,percentage FROM tax WHERE inactive=0 OR id=".$id." ORDER BY name"; 
     
    231300                        </select><?php 
    232301                         
    233                 } 
     302                }//end function 
    234303         
    235304         
    236305                function showDiscountSelect($id){ 
     306 
    237307                        $id=(int) $id; 
    238308                        $querystatement="SELECT id,name,type,value FROM discounts WHERE inactive!=1 ORDER BY name"; 
     
    251321                                ?> 
    252322                        </select><?php 
    253                 } 
     323 
     324                }//end function 
    254325         
    255326         
    256327                function getDiscount($id){ 
     328 
    257329                        $therecord["name"]=""; 
    258330                        $therecord["value"]=0; 
     
    273345         
    274346                        return $therecord; 
    275                 } 
     347 
     348                }//end function 
    276349                 
    277350         
    278351                function getTax($id){ 
     352 
    279353                        $therecord["name"]=""; 
    280354                         
     
    292366                         
    293367                        $therecord["name"]= htmlQuotes($therecord["name"]); 
     368                         
    294369                        return $therecord; 
    295                 } 
    296  
     370 
     371                }//end function 
     372 
     373 
     374                function prospectToClient($clientid){ 
     375                 
     376                        $updatestatement = " 
     377                                UPDATE 
     378                                        clients 
     379                                SET 
     380                                        type='client', 
     381                                        becameclient = NOW() 
     382                                WHERE 
     383                                        id=".$clientid; 
     384                         
     385                        $this->db->query($updatestatement); 
     386                 
     387                }//end function 
    297388                 
    298389                // CLASS OVERRIDES ====================================================================================== 
     
    429520                        }//end if 
    430521                         
     522                        if($variables["clienttype"] == "prospect" && $variables["clienttype"] == "Order") 
     523                                $this->prospectToClient($variables["id"]); 
     524                         
    431525                        //reset field after updating (if unset by rights management) 
    432526                        $this->getTableInfo(); 
     
    453547                        if($variables["statuschanged"]==1) 
    454548                                $this->updateStatus($newid,$variables["statusid"],$variables["statusdate"],$variables["assignedtoid"]); 
     549 
     550                        if($variables["clienttype"] == "prospect" && $variables["clienttype"] == "Order") 
     551                                $this->prospectToClient($variables["id"]); 
    455552         
    456553                        return $newid; 
     
    804901                         
    805902                        $whereclause=$this->buildWhereClause(); 
    806                         $whereclause="(".$whereclause.") AND invoices.type!='Invoice' AND invoices.type!='VOID'"; 
     903                        $whereclause="(".$whereclause.") AND invoices.type='Order'"; 
    807904 
    808905                        // since marking RTP is dependent on the payment method type, 
     
    858955                        $whereclause = $this->buildWhereClause(); 
    859956                        $whereclause = trim(" 
    860                                 invoices.type!='Invoice' 
    861                                 AND invoices.type!='VOID'  
     957                                invoices.type='Order' 
    862958                                AND paymentmethods.type != 'receivable'  
    863959                                AND (".$whereclause.")"); 
     
    9631059                                $this->whereclause = "(".$whereclause.") AND "; 
    9641060                         
    965                         $this->whereclause .= "invoices.type!=\"Invoice\" AND invoices.type!=\"VOID\" AND readytopost = 1"; 
     1061                        $this->whereclause .= "invoices.type='Order' AND readytopost = 1"; 
    9661062                 
    9671063                }//end method 
  • trunk/phpbms/modules/bms/install/modules.sql

    r285 r375  
    1 INSERT INTO modules VALUES (2,'BMS Module','bms','The Business Magagement functionality of phpBMS.  This module includes clients/propsetcs, quote/order/invoice, and products sections.','0.8'); 
     1INSERT INTO modules VALUES (2,'BMS Module','bms','The Business Magagement functionality of phpBMS.  This module includes clients/propsetcs, quote/order/invoice, and products sections.','0.94'); 
  • trunk/phpbms/modules/bms/install/settings.sql

    r311 r375  
    1515INSERT INTO `settings` (`name`, `value`) VALUES ('term3_days','90'); 
    1616INSERT INTO `settings` (`name`, `value`) VALUES ('term3_percentage','20'); 
     17INSERT INTO `settings` (`name`, `value`) VALUES ('prospects_on_orders','1'); 
  • trunk/phpbms/modules/bms/install/update.php

    r356 r375  
    278278                                        break; 
    279279 
     280                                // ================================================================================================ 
     281                                case "0.92"; 
     282 
     283                                        $thereturn.= processSQLfile($db,"updatev0.94.sql"); 
     284 
     285                                        //Updating Module Table 
     286                                        $updatestatement = " 
     287                                                UPDATE  
     288                                                        modules  
     289                                                SET  
     290                                                        version='0.94'  
     291                                                WHERE  
     292                                                        name='bms';"; 
     293 
     294                                        $db->query($updatestatement); 
     295 
     296                                        $thereturn .= "Update of Business Management System Module to 0.94 Finished\n\n"; 
     297 
     298                                        $ver["version"] = "0.94"; 
     299 
     300                                        break; 
     301 
    280302                        }//end switch 
    281303                }//end while 
  • trunk/phpbms/modules/bms/install/version.php

    r365 r375  
    33        $modules["bms"]["name"] = "Buisness Management System (BMS)"; 
    44         
    5         $modules["bms"]["version"] = 0.92
     5        $modules["bms"]["version"] = 0.94
    66         
    77        $modules["bms"]["description"] =  
    88        "The Business Magagement functionality of phpBMS.  This module includes clients/propsetcs, quote/order/invoice, and products sections."; 
    99         
    10         $modules["bms"]["requirements"] = "phpBMS Core v0.92"; 
     10        $modules["bms"]["requirements"] = "phpBMS Core v0.94"; 
    1111 
    1212?> 
  • trunk/phpbms/modules/bms/invoices_addedit.php

    r356 r375  
    9292                $theform->addField($theinput); 
    9393 
    94                 $theinput = new inputAutofill($db, "clientid",$therecord["clientid"],2,"clients.id","if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)", 
    95                                                                                 "if(clients.city!=\"\",concat(clients.city,\", \",clients.state),\"\")","clients.inactive!=1 AND clients.type=\"client\"", "client", true,true,false);                                   
    96                 $theinput->setAttribute("size","51"); 
    97                 $theinput->setAttribute("class","important"); 
    98                 $theform->addField($theinput); 
    99  
    10094                $theinput = new inputCheckBox("weborder",$therecord["weborder"],NULL, false, false); 
    10195                $theform->addField($theinput); 
     
    144138 
    145139         
    146         $pageTitle=ucwords($therecord["type"])
     140        $pageTitle = "Sales Order"
    147141         
    148142        $_SESSION["printing"]["tableid"]=3; 
     
    227221         
    228222        <div id="fsTops"> 
    229                 <fieldset > 
    230                         <legend><label for="ds-clientid">client</label></legend> 
    231                         <div class="important fauxP"> 
    232                                   <?php $theform->fields["clientid"]->display();  
    233                                   if($therecord["id"]){?> 
    234                                   <button type="button" title="view client" class="graphicButtons buttonInfo" onclick="viewClient('<?php echo getAddEditFile($db,2) ?>')"><span>view client</span></button> 
    235                                   <?php }//end if?> 
    236                         </div> 
     223                <fieldset> 
     224                        <legend><label for="clientdisplay">client</label></legend> 
     225                        <p> 
     226                                <input type="hidden" id="clientAddEditFile" value="<?php echo getAddEditFile($db,2) ?>"/> 
     227                                <?php $thetable->showClientField($therecord["clientid"]);?> 
     228                        </p> 
    237229                </fieldset> 
    238230                 
  • trunk/phpbms/modules/bms/invoices_client_ajax.php

    r311 r375  
    4242class clientList{ 
    4343 
     44        var $recordcount = 0; 
     45 
    4446        function clientList($db){ 
    4547                 
     
    4951 
    5052 
    51         function getData($id){ 
     53        function getSingleRecord($id){ 
    5254 
    5355                $returnArray = array( 
     
    9698                }//end if 
    9799                 
     100                $this->recordcount = 1; 
     101                 
    98102                return $returnArray; 
    99         }//end method 
    100  
    101          
    102         function showXML($therecord){ 
     103                 
     104        }//end method 
     105 
     106 
     107        function findRecords($term, $offset=0){ 
     108         
     109                $term = trim(mysql_real_escape_string($term)); 
     110                 
     111                $terms = explode(" ",$term); 
     112                 
     113                 
     114                $prospects=""; 
     115                 
     116                if(!PROSPECTS_ON_ORDERS) 
     117                        $prospects = "AND clients.type = 'client'"; 
     118                 
     119                $wheres=""; 
     120                foreach($terms as $value){ 
     121                 
     122                        $wheres .=" 
     123                                AND ( 
     124                                        clients.company LIKE '".$value."%' 
     125                                        OR clients.company LIKE '% ".$value."%' 
     126                                        OR clients.firstname LIKE '".$value."%' 
     127                                        OR clients.lastname LIKE '".$value."%' 
     128                                        OR clients.lastname LIKE '%-".$value."%' 
     129                                )"; 
     130                 
     131                }//endforeach 
     132         
     133                $querystatement = " 
     134                        SELECT 
     135                                id, 
     136                                firstname, 
     137                                lastname, 
     138                                company, 
     139                                type, 
     140                                city, 
     141                                state, 
     142                                postalcode, 
     143                                country 
     144                        FROM 
     145                                clients 
     146                        WHERE 
     147                                clients.inactive = 0 
     148                                ".$prospects." 
     149                                ".$wheres." 
     150                        ORDER BY 
     151        &n