phpBMS

Changeset 184

Show
Ignore:
Timestamp:
02/15/07 17:55:42 (5 years ago)
Author:
brieb
Message:

Implements #18. Fixes #73, #74, #75

Location:
trunk/phpbms
Files:
6 added
34 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/advancedsearch.php

    r145 r184  
    5959                </p> 
    6060 
    61                 <p>match <select id="ASanyall" onChange="updateAS()"> 
     61                <p>match <select id="ASanyall" onchange="updateAS()"> 
    6262                        <option value="and" selected="selected">all</option> 
    6363                        <option value="or">any</option> 
     
    6565                <div id="theASCs"> 
    6666                        <div id="ASC1"> 
    67                                 <select id="ASC1field" onChange="updateAS()"> 
     67                                <select id="ASC1field" onchange="updateAS()"> 
    6868                                        <?php  
    6969                                                foreach($fieldlist as $field){ 
    7070                                                        echo "<option value=\"".$field."\" >".$field."</option>\n";}?> 
    7171                                </select> 
    72                                 <select id="ASC1operator" onChange="updateAS()"> 
     72                                <select id="ASC1operator" onchange="updateAS()"> 
    7373                                         <option value="=" selected="selected">=</option> 
    7474                                         <option value="!=">!=</option> 
  • trunk/phpbms/advancedsort.php

    r155 r184  
    6363                $numrows=mysql_num_rows($queryresult); 
    6464                ?> 
    65                 <select id="sortSavedList" name="sortSavedList" <?php if ($numrows<1) echo "disabled" ?> size="10" style="width:99%" onChange="sortSavedSelect(this)" /> 
     65                <select id="sortSavedList" name="sortSavedList" <?php if ($numrows<1) echo "disabled" ?> size="10" style="width:99%" onchange="sortSavedSelect(this)" /> 
    6666                        <?php if($numrows<1) {?> 
    6767                                <option value="NA">No Saved Sorts</option> 
     
    144144                                        <div id="theSorts"> 
    145145                                                <div id="Sort1"> 
    146                                                         <select id="Sort1Field" onChange="updateSort()"> 
     146                                                        <select id="Sort1Field" onchange="updateSort()"> 
    147147                                                                <?php  
    148148                                                                        foreach($fieldlist as $field){ 
    149149                                                                                echo "<option value=\"".$field."\" >".$field."</option>\n";}?> 
    150150                                                        </select> 
    151                                                         <select id="Sort1Order" onChange="updateSort()"> 
     151                                                        <select id="Sort1Order" onchange="updateSort()"> 
    152152                                                                 <option value="ASC" selected="selected">Ascending</option> 
    153153                                                                 <option value="DESC">Descending</option> 
  • trunk/phpbms/common/javascript/fields.js

    r145 r184  
    271271        theitem.value=formatCurrency(thenumber); 
    272272         
    273         //in case the field has an additional onChange code to be run 
     273        //in case the field has an additional onchange code to be run 
    274274        if (theitem.thechange) theitem.thechange(); 
    275275} 
  • trunk/phpbms/common/stylesheet/mozilla/pages/invoice.css

    r176 r184  
    1717#printButton input{width:75px;} 
    1818 
    19 #fsAttributes{clear:both;float:right;width:250px;} 
     19#fsAttributes{clear:both;float:right;width:260px;} 
    2020#attributesRight{float:right;padding-top:0px;} 
    2121#type{width:90px} 
    22 #leadsource{width:98%} 
     22#leadsource,#statusid{width:98%} 
     23#ds-assignedtoid{width:99%} 
    2324 
    24 #fsTops{margin-right:275px;} 
     25 
     26#fsTops{margin-right:270px;} 
    2527#address1{margin-bottom:2px;} 
    2628.cszP{float:left;} 
  • trunk/phpbms/include/common_functions.php

    r177 r184  
    206206 
    207207function addSlashesToArray($thearray){ 
    208         if(!get_magic_quotes_runtime() && !get_magic_quotes_gpc()) 
    209                 foreach($thearray as $key=>$value) 
    210                         $thearray[$key]=addslashes($value); 
     208        if(get_magic_quotes_runtime() || get_magic_quotes_gpc()) 
     209                foreach ($thearray as $key=>$value)  
     210                        $thearray[$key] = stripslashes($value); 
     211         
     212        foreach ($thearray as $key=>$value) 
     213                $thearray[$key] = mysql_real_escape_string($value); 
     214         
    211215        return $thearray; 
    212216} 
  • trunk/phpbms/include/fields.php

    r176 r184  
    268268        if(is_numeric($value)) $value=$value."%";        
    269269        ?><input name="<?php echo $name?>" id="<?php echo $name?>" type="text" value="<?php echo $value?>" <?php 
    270         if ($attributes) foreach($attributes as $attribute => $tvalue) if($attribute!="onChange") echo " ".$attribute."=\"".$tvalue."\""; 
    271         ?> onchange="validatePercentage(this,<?php echo $precision ?>);<?php if(isset($attributes["onChange"])) echo $attributes["onChange"] ?>" style="text-align:right;" /><?php 
     270        if ($attributes) foreach($attributes as $attribute => $tvalue) if($attribute!="onchange") echo " ".$attribute."=\"".$tvalue."\""; 
     271        ?> onchange="validatePercentage(this,<?php echo $precision ?>);<?php if(isset($attributes["onchange"])) echo $attributes["onchange"] ?>" style="text-align:right;" /><?php 
    272272        if ($required) {?><script language="JavaScript" type="text/javascript">requiredArray[requiredArray.length]=new Array('<?php echo $name?>','<?php echo $message?>');</script><?php }//end required if 
    273273} 
     
    287287        if ($attributes)  
    288288                foreach($attributes as $attribute => $tvalue)  
    289                         if($attribute!="onChange")  
     289                        if($attribute!="onchange")  
    290290                                echo " ".$attribute."=\"".$tvalue."\"";                          
    291         ?> onchange="formatDateField(this);<?php if(isset($attributes["onChange"])) echo $attributes["onChange"]?>" /><button id="<?php echo $name?>Button" type="button" class="graphicButtons buttonDate" onclick="showDP('<?php echo $_SESSION["app_path"]?>','<?php echo $name?>');"><span>pick date</span></button> 
     291        ?> onchange="formatDateField(this);<?php if(isset($attributes["onchange"])) echo $attributes["onchange"]?>" /><button id="<?php echo $name?>Button" type="button" class="graphicButtons buttonDate" onclick="showDP('<?php echo $_SESSION["app_path"]?>','<?php echo $name?>');"><span>pick date</span></button> 
    292292        <?php if ($required) {?><script language="JavaScript" type="text/javascript">requiredArray[requiredArray.length]=new Array('<?php echo $name?>','<?php echo $message?>');</script><?php }//end if 
    293293        ?><script language="JavaScript" type="text/javascript">dateArray[dateArray.length]=new Array('<?php echo $name?>','<?php echo $message?>');</script><?php  
  • trunk/phpbms/include/login_include.php

    r170 r184  
    4242                $querystatement="SELECT id, firstname, lastname, email, phone, department, employeenumber, admin 
    4343                                                FROM users  
    44                                                 WHERE login=\"".$username."\" and password=ENCODE(\"".$password."\",\"".$seed."\") and revoked=0 and portalaccess=0"; 
     44                                                WHERE login=\"".mysql_real_escape_string($username)."\" and password=ENCODE(\"".mysql_real_escape_string($password)."\",\"".mysql_real_escape_string($seed)."\") and revoked=0 and portalaccess=0"; 
    4545                $queryresult=mysql_query($querystatement,$dblink); 
    4646                if(!$queryresult) reportError(300,"Error verifing user record: ".$querystatement); 
  • trunk/phpbms/include/print_class.php

    r170 r184  
    177177 
    178178                ?> 
    179                 <select name="singlefield" onChange="checkForCustom(this.value)"> 
     179                <select name="singlefield" onchange="checkForCustom(this.value)"> 
    180180                        <?php  
    181181                                foreach($fieldlist as $field){ 
  • trunk/phpbms/include/search_class.php

    r177 r184  
    530530                        echo "<div>records:&nbsp;".$this->numrows."</div>"; 
    531531                else {?>                         
    532                         <input name="offset" type="hidden" value=""><select name="offsetselector" onChange="this.form.offset.value=this.value;this.form.submit();"> 
     532                        <input name="offset" type="hidden" value=""><select name="offsetselector" onchange="this.form.offset.value=this.value;this.form.submit();"> 
    533533                                <?php 
    534534                                        $displayedoffset=0; 
     
    569569         
    570570                        if($this->tableoptions["othercommands"] || ($this->thetabledef["deletebutton"] != "delete" && $this->thetabledef["deletebutton"] != "NA") ){?>                   
    571                                 <select id="othercommands" name="othercommands" disabled=true onChange="chooseOtherCommand(this)"> 
     571                                <select id="othercommands" name="othercommands" disabled=true onchange="chooseOtherCommand(this)"> 
    572572                                <option value="" selected class="choiceListBlank">commands...</option> 
    573573                                <?php if($this->thetabledef["deletebutton"] != "delete" && $this->thetabledef["deletebutton"] != "NA") {?> 
     
    583583                                ?></select><?php 
    584584                } 
    585                 if($this->tableoptions["select"]["allowed"] && hasRights($this->tableoptions["select"]["roleid"])){?> <select id="searchSelection" onChange="perfromToSelection(this)"> 
     585                if($this->tableoptions["select"]["allowed"] && hasRights($this->tableoptions["select"]["roleid"])){?> <select id="searchSelection" onchange="perfromToSelection(this)"> 
    586586                                <option class="choiceListBlank" value="">selection...</option> 
    587587                                <option value="">_____________</option> 
     
    634634        if (mysql_num_rows($queryresult)) { 
    635635                ?><div class="small box" style="margin:0px;margin-top:3px;"> 
    636                 relate selected records to <select id="relationship" name="relationship" onChange="setSelIDs(this.form);this.form.submit();"    disabled="true"> 
     636                relate selected records to <select id="relationship" name="relationship" onchange="setSelIDs(this.form);this.form.submit();"    disabled="true"> 
    637637                        <option value="" selected class="choiceListBlank">area...</option><?php  
    638638                        while($therecord = mysql_fetch_array($queryresult)){ 
  • trunk/phpbms/index.php

    r155 r184  
    6565                        <p> 
    6666                                <label for="username">name</label><br /> 
    67                                 <input name="name" type="text" id="username" size="25" maxlength="64" value="<?php echo $_POST["name"]?>"/> 
     67                                <input name="name" type="text" id="username" size="25" maxlength="64" value="<?php echo htmlQuotes($_POST["name"])?>"/> 
    6868                        </p> 
    6969                         
  • trunk/phpbms/loadsearch.php

    r170 r184  
    8181                $numrows=mysql_num_rows($queryresult); 
    8282                ?> 
    83                 <select id="LSList" name="LSList" <?php if ($numrows<1) echo "disabled" ?> size="10" style="width:170px;height:160px;" onChange="LSsearchSelect(this,'<?php echo $basepath ?>')"> 
     83                <select id="LSList" name="LSList" <?php if ($numrows<1) echo "disabled" ?> size="10" style="width:170px;height:160px;" onchange="LSsearchSelect(this,'<?php echo $basepath ?>')"> 
    8484                        <?php if($numrows<1) {?> 
    8585                                <option value="NA">No Saved Searches</option> 
  • trunk/phpbms/modules/base/notes_addedit.php

    r170 r184  
    7979                <p> 
    8080                        <label for="type" class="important">type</label><br /> 
    81                         <?php basic_choicelist("thetype",$therecord["type"],array(array("value"=>"NT","name"=>"Note"),array("value"=>"TS","name"=>"Task"),array("value"=>"EV","name"=>"Event"),array("value"=>"SM","name"=>"System Message")),Array("class"=>"important","onChange"=>"changeType();"));?> 
     81                        <?php basic_choicelist("thetype",$therecord["type"],array(array("value"=>"NT","name"=>"Note"),array("value"=>"TS","name"=>"Task"),array("value"=>"EV","name"=>"Event"),array("value"=>"SM","name"=>"System Message")),Array("class"=>"important","onchange"=>"changeType();"));?> 
    8282                        <input type="hidden" id="typeCheck" name="typeCheck" value="<?php echo $therecord["type"]?>" />          
    8383                </p> 
     
    103103                                <label for="startdate" id="starttext">start</label><br /> 
    104104                                <input name="dostart" id="startcheck" type="checkbox" value="1" <?php if($therecord["startdate"]) echo "checked" ?> onClick="dateChecked('start')" class="radiochecks" /> 
    105                                 &nbsp;<?php field_datepicker("startdate",$therecord["startdate"],0,"",Array("size"=>"11","maxlength"=>"15","onChange"=>"checkEndDate();setEnglishDates()"));?>   
    106                                 &nbsp;<?php field_timepicker("starttime",$therecord["starttime"],0,"",Array("size"=>"11","maxlength"=>"15","onChange"=>"checkEndDate()"));?> 
     105                                &nbsp;<?php field_datepicker("startdate",$therecord["startdate"],0,"",Array("size"=>"11","maxlength"=>"15","onchange"=>"checkEndDate();setEnglishDates()"));?>   
     106                                &nbsp;<?php field_timepicker("starttime",$therecord["starttime"],0,"",Array("size"=>"11","maxlength"=>"15","onchange"=>"checkEndDate()"));?> 
    107107                        </p> 
    108108                        <p> 
     
    209209                                                if($therecord["repeatfrequency"]>1) $plural="s"; 
    210210                                        ?> 
    211                                         <select id="repeattype" name="repeattype" onChange="changeRepeatType();"> 
     211                                        <select id="repeattype" name="repeattype" onchange="changeRepeatType();"> 
    212212                                                <option value="Daily" <?php if ($therecord["repeattype"]=="repeatDaily") echo "selected"?>>Day<?php echo $plural?></option> 
    213213                                                <option value="Weekly" <?php if ($therecord["repeattype"]=="repeatWeekly") echo "selected"?>>Week<?php echo $plural?></option> 
  • trunk/phpbms/modules/bms/clients_email.php

    r166 r184  
    131131                        <p id="toP"> 
    132132                                <label for="therecords">to</label><br />                         
    133                                 <select id="therecords" name="therecords" onChange="showSavedSearches(this);"> 
     133                                <select id="therecords" name="therecords" onchange="showSavedSearches(this);"> 
    134134                                        <option value="selected" <?php if ($therecord["emailto"]=="selected") echo "selected"?>>e-mail addresses from selected records (<?php echo count($_SESSION["emailids"]) ?> record<?php if(count($_SESSION["emailids"])>1) echo "s"?>)</option> 
    135135                                        <option value="savedsearch" <?php if ($therecord["emailto"]!="selected" AND $therecord["emailto"]!="all") echo "selected"?>>e-mail addresses from saved search...</option> 
  • trunk/phpbms/modules/bms/clients_purchasehistory.php

    r161 r184  
    119119</head> 
    120120<body><?php include("../../menu.php")?> 
    121 <?php client_tabs("Purchase History",$_GET["id"]);?><div class="bodyline" style="padding:4px;"> 
     121<?php client_tabs("Purchase History",$_GET["id"]);?><div class="bodyline"> 
    122122        <h1><?php echo $pageTitle ?></h1> 
    123123 
     
    125125                <div class="box"> 
    126126                        <p class="timelineP"> 
    127                            <label for="status">invoice status</label><br /> 
     127                           <label for="status">type</label><br /> 
    128128                           <select name="status" id="status"> 
    129129                                        <option value="Orders/Invoices" <?php if($_POST["status"]=="Orders/Invoices") echo "selected"?>>Orders/Invoices</option> 
     
    171171        ?> 
    172172        <tr class="row<?php echo $row?>"> 
    173                 <td style="padding:0px;margin:0px;" nowrap> 
     173                <td > 
    174174                        <button type="button" class="invisibleButtons" onClick="location.href='<?php echo getAddEditFile(3) ?>?id=<?php echo $therecord["id"]?>'"><img src="<?php echo $_SESSION["app_path"] ?>common/stylesheet/<?php echo $_SESSION["stylesheet"] ?>/image/button-edit.png" align="middle" alt="edit" width="16" height="16" border="0" /></button> 
    175175                </td> 
  • trunk/phpbms/modules/bms/include/invoices_addedit_include.php

    r176 r184  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
     39function updateStatus($invoiceid,$statusid,$statusdate,$assignedtoid,$dblink){ 
     40        $querystatement="DELETE FROM invoicestatushistory WHERE invoiceid=".$invoiceid." AND invoicestatusid=".$statusid; 
     41        $queryresult=mysql_query($querystatement,$dblink); 
     42        if(!$queryresult) reportError(300,"Error Updating Status History: deleteing<br />".mysql_error($dblink)); 
     43         
     44        $querystatement="INSERT INTO invoicestatushistory (invoiceid,invoicestatusid,statusdate,assignedtoid) values("; 
     45        $querystatement.=((int) $invoiceid).", "; 
     46        $querystatement.=((int) $statusid).", "; 
     47 
     48        if($statusdate=="" || $statusdate=="0/0/0000") $tempdate="NULL"; 
     49        else{ 
     50                $sd="/".ereg_replace(",.","/",$statusdate); 
     51                $temparray=explode("/",$sd); 
     52                $tempdate="\"".$temparray[3]."-".$temparray[1]."-".$temparray[2]."\""; 
     53        } 
     54        $querystatement.=$tempdate.","; 
     55        if($assignedtoid=="") 
     56                $querystatement.="NULL"; 
     57        else 
     58                $querystatement.=((int) $assignedtoid); 
     59 
     60        $querystatement.=")"; 
     61 
     62        $queryresult=mysql_query($querystatement,$dblink); 
     63        if(!$queryresult) reportError(300,"Error Updating Status History: inserting<br />".mysql_error($dblink)); 
     64} 
     65 
    3966function showPaymentSelect($id,$paymentMethods){ 
    4067        ?><select name="paymentmethodid" id="paymentmethodid" onchange="showPaymentOptions()"> 
     
    233260} 
    234261 
     262function getDefaultStatus(){ 
     263        global $dblink; 
     264                 
     265        $querystatement="SELECT id FROM invoicestatuses WHERE invoicedefault=1"; 
     266        $queryresult=mysql_query($querystatement,$dblink); 
     267        if(!$queryresult) reportError(100,"Could Not Retrieve Stauts Default: ".mysql_error($dblink)."<br /><br />".$querystatement); 
     268        $therecord=mysql_fetch_array($queryresult); 
     269         
     270        return $therecord["id"]; 
     271} 
     272 
     273function displayStatusDropDown($statusid,$dblink){ 
     274        $querystatement="SELECT invoicestatuses.id,invoicestatuses.name,invoicestatuses.invoicedefault,users.firstname,users.lastname FROM  
     275                                        (invoicestatuses LEFT JOIN users ON invoicestatuses.defaultassignedtoid=users.id)WHERE invoicestatuses.inactive=0 
     276                                        ORDER BY invoicestatuses.priority,invoicestatuses.name"; 
     277        $queryresult=mysql_query($querystatement,$dblink); 
     278        if(!$queryresult) reportError(300,"Error Retrieving Statuses: ".mysql_error($dblink));   
     279        ?><select id="statusid" name="statusid" onchange="updateAssignedTo();updateStatusDate()" class="important"> 
     280                <?php 
     281                $options=""; 
     282                while($therecord=mysql_fetch_array($queryresult)){ 
     283                        if($therecord["firstname"]!="" || $therecord["lastname"]!="") 
     284                                $options["s".$therecord["id"]]=trim($therecord["firstname"]." ".$therecord["lastname"]); 
     285                        ?><option value="<?php echo $therecord["id"]?>" <?php if($statusid==$therecord["id"]) echo "selected=\"selected\""?>><?php echo $therecord["name"]?></option><?php 
     286                } 
     287                ?> 
     288        </select><script language="javascript" type="text/javascript">statusAssignedto=new Array;<?php  
     289                if($options!="") 
     290                        foreach($options as $key=>$value){ 
     291                                echo "statusAssignedto[\"".$key."\"] = \"".$value."\";\n"; 
     292                        } 
     293?></script><?php 
     294} 
    235295 
    236296// These following functions and processing are similar for all pages 
     
    252312        global $dblink; 
    253313         
    254         $querystatement="SELECT id, clientid, status, type, totalweight, totaltni, totalti, totalcost, 
     314        $querystatement="SELECT id, clientid, statusid, assignedtoid, type, totalweight, totaltni, totalti, totalcost, 
    255315                                        leadsource, shippingmethodid, paymentmethodid, checkno, bankname, ccnumber, routingnumber,  
    256316                                        accountnumber, transactionid, 
     
    261321                                        date_Format(invoicedate,\"%c/%e/%Y\") as invoicedate, 
    262322                                        date_Format(orderdate,\"%c/%e/%Y\") as orderdate, 
    263                                         date_Format(shippeddate,\"%c/%e/%Y\") as shippeddate, 
     323                                        date_Format(statusdate,\"%c/%e/%Y\") as statusdate, 
    264324                                        ponumber, 
    265325                                        date_Format(requireddate,\"%c/%e/%Y\") as requireddate, 
     
    293353                $therecord["clientid"]=$_GET["cid"]; 
    294354        $therecord["type"]="Order"; 
    295         $therecord["status"]="Open"; 
     355        $therecord["statusid"]=getDefaultStatus(); 
     356        $therecord["statusdate"]=date("n/d/Y"); 
     357        $therecord["assignedtoid"]=""; 
    296358 
    297359        $therecord["leadsource"]=""; 
     
    324386 
    325387        $therecord["weborder"]=0; 
    326         $therecord["shippeddate"]=NULL; 
    327388        $therecord["trackingno"]=""; 
    328389        $therecord["webconfirmationno"]=""; 
     
    377438 
    378439                        $querystatement.="type=\"".$variables["type"]."\", ";  
    379                         $querystatement.="status=\"".$variables["status"]."\", ";  
     440 
     441                        $querystatement.="statusid=".((int)$variables["statusid"]).", "; 
     442                        $querystatement.="assignedtoid=".((int) $variables["assignedtoid"]).", "; 
     443                        if($variables["statusdate"]=="" || $variables["statusdate"]=="0/0/0000") $tempdate="NULL"; 
     444                        else{ 
     445                                $statusdate="/".ereg_replace(",.","/",$variables["statusdate"]); 
     446                                $temparray=explode("/",$statusdate); 
     447                                $tempdate="\"".$temparray[3]."-".$temparray[1]."-".$temparray[2]."\""; 
     448                        } 
     449                        $querystatement.="statusdate=".$tempdate.", "; 
     450 
    380451                         
    381452                                if($variables["orderdate"]=="" || $variables["orderdate"]=="0/0/0000") $tempdate="NULL"; 
     
    399470                                } 
    400471                                //make sure there is an invoice date if the status is set to invoice!!! 
    401                                 if($variables["status"]=="Invoice" && $tempdate=="NULL") $tempdate="Now()"; 
     472                                if($variables["type"]=="Invoice" && $tempdate=="NULL") $tempdate="Now()"; 
    402473                        $querystatement.="invoicedate=".$tempdate.", ";  
    403474                 
     
    428499                        $querystatement.="shippingmethodid=".$variables["shippingmethodid"].", ";  
    429500 
    430                         if($variables["shippeddate"]=="" || $variables["shippeddate"]=="0/0/0000")  
    431                                 {$tempdate="NULL";} 
    432                         else{ 
    433                                         $shippeddate="/".ereg_replace(",.","/",$variables["shippeddate"]); 
    434                                         $temparray=explode("/",$shippeddate); 
    435                                         $tempdate="\"".$temparray[3]."-".$temparray[1]."-".$temparray[2]."\""; 
    436                                 } 
    437                         $querystatement.="shippeddate=".$tempdate.", ";  
    438501                        $querystatement.="trackingno=\"".$variables["trackingno"]."\", ";  
    439502 
     
    486549        if($variables["lineitemschanged"]==1) 
    487550                addLineItems($variables["thelineitems"],$variables["id"],$userid); 
     551 
     552        if($variables["statuschanged"]==1) 
     553                updateStatus($variables["id"],$variables["statusid"],$variables["statusdate"],$variables["assignedtoid"],$dblink); 
    488554                 
    489555        return "Record Updated"; 
     
    495561        global $dblink; 
    496562 
    497         if($variables["status"]=="VOID"){ 
     563        if($variables["type"]=="VOID"){ 
    498564                $variables["totaltni"]=0; 
    499565                $variables["totalti"]=0; 
     
    501567        } 
    502568        $querystatement="INSERT INTO invoices  
    503                         (clientid,leadsource,type,status,orderdate,discountamount,discountid, 
     569                        (clientid,leadsource,type,statusid,assignedtoid,statusdate,orderdate,discountamount,discountid, 
    504570                        invoicedate,address1,address2,city,state,postalcode, country, totaltni, totaltaxable, totalti,shipping,tax,amountpaid, 
    505                         totalcost,totalweight,shippingmethodid,shippeddate,trackingno,paymentmethodid,accountnumber,routingnumber,transactionid, 
     571                        totalcost,totalweight,shippingmethodid,trackingno,paymentmethodid,accountnumber,routingnumber,transactionid, 
    506572                        checkno,bankname,ccnumber,ccexpiration,ccverification,specialinstructions,printedinstructions, 
    507573                        taxareaid, taxpercentage, weborder,webconfirmationno,ponumber,requireddate, 
     
    512578 
    513579                        $querystatement.="\"".$variables["type"]."\", ";  
    514                         $querystatement.="\"".$variables["status"]."\", ";  
     580                        $querystatement.=((int)$variables["statusid"]).", "; 
     581                        $querystatement.=((int) $variables["assignedtoid"]).", "; 
     582                        if($variables["statusdate"]=="" || $variables["statusdate"]=="0/0/0000") $tempdate="NULL"; 
     583                        else{ 
     584                                $statusdate="/".ereg_replace(",.","/",$variables["statusdate"]); 
     585                                $temparray=explode("/",$statusdate); 
     586                                $tempdate="\"".$temparray[3]."-".$temparray[1]."-".$temparray[2]."\""; 
     587                        } 
     588                        $querystatement.=$tempdate.", "; 
    515589                         
    516590                                if($variables["orderdate"]=="" || $variables["orderdate"]=="0/0/0000") $tempdate="NULL"; 
     
    534608                                } 
    535609                                //make sure there is an invoice date if the status is set to invoice!!! 
    536                                 if($variables["status"]=="Invoice" && $tempdate=="NULL") $tempdate="Now()"; 
     610                                if($variables["type"]=="Invoice" && $tempdate=="NULL") $tempdate="Now()"; 
    537611                        $querystatement.=$tempdate.", ";  
    538612                 
     
    563637                        $querystatement.=$variables["shippingmethodid"].", ";  
    564638 
    565                                 if($variables["shippeddate"]=="" || $variables["shippeddate"]=="0/0/0000") $tempdate="NULL"; 
    566                                 else{ 
    567                                         $shippeddate="/".ereg_replace(",.","/",$variables["shippeddate"]); 
    568                                         $temparray=explode("/",$shippeddate); 
    569                                         $tempdate="\"".$temparray[3]."-".$temparray[1]."-".$temparray[2]."\""; 
    570                                 } 
    571                         $querystatement.=$tempdate.", ";  
    572639                        $querystatement.="\"".$variables["trackingno"]."\", ";  
    573640 
     
    617684        if($variables["lineitemschanged"]==1) 
    618685                addLineItems($variables["thelineitems"],$newid,$userid); 
     686 
     687        if($variables["statuschanged"]==1) 
     688                updateStatus($newid,$variables["statusid"],$variables["statusdate"],$variables["assignedtoid"],$dblink); 
    619689         
    620690        return $newid; 
  • trunk/phpbms/modules/bms/include/invoices_functions.php

    r145 r184  
    5757                ), 
    5858                array( 
     59                        "name"=>"Status History", 
     60                        "href"=>(($id)?"invoices_statushistory.php?refid=".$id:"N/A"), 
     61                        "disabled"=>(($id)?false:true), 
     62                ), 
     63                array( 
    5964                        "name"=>"Attachments", 
    6065                        "href"=>(($id)?"invoices_attachments.php?refid=".$id:"N/A"), 
  • trunk/phpbms/modules/bms/include/invoices_search_functions.php

    r145 r184  
    4747 
    4848        $whereclause=buildWhereClause($theids,"invoices.id"); 
    49          
    50         $querystatement = "UPDATE invoices SET invoices.status=\"Shipped\",invoices.shippeddate=Now(),modifiedby=\"".$_SESSION["userinfo"]["id"]."\" WHERE (".$whereclause.") AND (invoices.type!=\"Invoice\" or invoices.type!=\"VOID\");"; 
     49        $whereclause="(".$whereclause.") AND (invoices.type!=\"Invoice\" or invoices.type!=\"VOID\");"; 
     50 
     51        //Look up default assignedto 
     52        $querystatement="SELECT defaultassignedtoid FROM invoicestatuses WHERE id=4"; 
     53        $queryresult = mysql_query($querystatement,$dblink); 
     54        if (!$queryresult) reportError(300,"Could not retrieve default assignedto: ".mysql_error($dblink)." -- ".$querystatement);               
     55        $therecord=mysql_fetch_array($queryresult); 
     56        $assignedtoid="NULL"; 
     57        if($therecord["defaultassignedtoid"]!="") 
     58                $assignedtoid=$therecord["defaultassignedtoid"]; 
     59 
     60        $querystatement = "UPDATE invoices SET invoices.statusid=4, invoices.statusdate=Now(), assignedtoid=".$assignedtoid.",modifiedby=\"".$_SESSION["userinfo"]["id"]."\" WHERE ".$whereclause; 
    5161        $queryresult = mysql_query($querystatement,$dblink); 
    5262        if (!$queryresult) reportError(300,"Couldn't Mark As Shipped: ".mysql_error($dblink)." -- ".$querystatement);            
     
    5464        $message=buildStatusMessage(mysql_affected_rows($dblink),count($theids)); 
    5565        $message.=" marked as shipped."; 
     66 
     67        //delete/update history 
     68        $querystatement="SELECT id FROM invoices WHERE ".$whereclause; 
     69        $queryresult = mysql_query($querystatement,$dblink); 
     70         
     71        while($therecord=mysql_fetch_array($queryresult)){ 
     72                $querystatement="DELETE FROM invoicestatushistory WHERE invoiceid=".$therecord["id"]." AND invoicestatusid=4"; 
     73                $deleteresult = mysql_query($querystatement,$dblink); 
     74                if (!$deleteresult ) reportError(300,"Could not delete status history: ".mysql_error($dblink)." -- ".$querystatement);           
     75                 
     76                $querystatement="INSERT INTO invoicestatushistory (invoiceid,invoicestatusid,statusdate,assignedtoid) values ("; 
     77                $querystatement.=$therecord["id"].",4,NOW(),"; 
     78                $querystatement.=$assignedtoid; 
     79                $querystatement.=")"; 
     80                $insertresult = mysql_query($querystatement,$dblink); 
     81                if (!$insertresult) reportError(300,"Could not insert status history: ".mysql_error($dblink)." -- ".$querystatement);            
     82        } 
     83 
    5684 
    5785        return $message; 
     
    6492 
    6593        $whereclause=buildWhereClause($theids,"invoices.id"); 
    66          
     94                 
    6795        $querystatement = "UPDATE invoices SET invoices.amountpaid=invoices.totalti,modifiedby=\"".$_SESSION["userinfo"]["id"]."\" WHERE (".$whereclause.") AND (invoices.type!=\"Invoice\" OR invoices.type!=\"VOID\")"; 
    6896        $queryresult = mysql_query($querystatement,$dblink); 
     
    7199        $message=buildStatusMessage(mysql_affected_rows($dblink),count($theids)); 
    72100        $message.=" marked as paid in full."; 
     101 
     102         
    73103 
    74104        return $message; 
     
    80110 
    81111        $whereclause=buildWhereClause($theids,"invoices.id"); 
     112        $whereclause="(".$whereclause.") AND (invoices.type!=\"Invoice\" OR invoices.type!=\"VOID\") AND invoices.amountpaid=invoices.totalti;"; 
    82113         
    83         $querystatement = "UPDATE invoices SET invoices.type=\"Invoice\",invoices.status=\"shipped\",invoices.invoicedate=ifnull(invoices.invoicedate,Now()),modifiedby=\"".$_SESSION["userinfo"]["id"]."\" WHERE (".$whereclause.") AND (invoices.type!=\"Invoice\" OR invoices.type!=\"VOID\") AND invoices.amountpaid=invoices.totalti;"; 
     114        //Look up default assignedto 
     115        $querystatement="SELECT defaultassignedtoid FROM invoicestatuses WHERE id=4"; 
    84116        $queryresult = mysql_query($querystatement,$dblink); 
    85         if (!$queryresult) reportError(300,"Could not convert to client: ".mysql_error($dblink)." -- ".$querystatement);                 
     117        if (!$queryresult) reportError(300,"Could not retrieve default assignedto: ".mysql_error($dblink)." -- ".$querystatement);               
     118        $therecord=mysql_fetch_array($queryresult); 
     119        $assignedtoid="NULL"; 
     120        if($therecord["defaultassignedtoid"]!="") 
     121                $assignedtoid=$therecord["defaultassignedtoid"]; 
     122 
     123        $querystatement = "UPDATE invoices SET invoices.type=\"Invoice\" invoices.invoicedate=ifnull(invoices.invoicedate,Now()),modifiedby=\"".$_SESSION["userinfo"]["id"]."\" WHERE".$whereclause; 
     124        $queryresult = mysql_query($querystatement,$dblink); 
     125        if (!$queryresult) reportError(300,"Could not mark as invoice: ".mysql_error($dblink)." -- ".$querystatement);           
    86126         
    87127        $message=buildStatusMessage(mysql_affected_rows($dblink),count($theids)); 
    88128        $message.=" converted to invoice."; 
     129 
     130        //delete/update history 
     131        $querystatement="SELECT id FROM invoices WHERE (".$whereclause.") AND statusid!=4"; 
     132        $queryresult = mysql_query($querystatement,$dblink); 
     133         
     134        while($therecord=mysql_fetch_array($queryresult)){ 
     135                $querystatement = "UPDATE invoices SET invoices.statusid=4,invoices.statusdate=Now(), invoices.assignedtoid=".$assignedtoid.", WHERE id=".$therecord["id"]; 
     136                $queryresult = mysql_query($querystatement,$dblink); 
     137                if (!$queryresult) reportError(300,"Could not mark as invoice: ".mysql_error($dblink)." -- ".$querystatement);           
     138 
     139                $querystatement="DELETE FROM invoicestatushistory WHERE invoiceid=".$therecord["id"]." AND invoicestatusid=4"; 
     140                $deleteresult = mysql_query($querystatement,$dblink); 
     141                if (!$deleteresult ) reportError(300,"Could not delete status history: ".mysql_error($dblink)." -- ".$querystatement);           
     142                 
     143                $querystatement="INSERT INTO invoicestatushistory (invoiceid,invoicestatusid,statusdate,assignedtoid) values ("; 
     144                $querystatement.=$therecord["id"].",4,NOW(),"; 
     145                $querystatement.=$assignedtoid; 
     146                $querystatement.=")"; 
     147                $insertresult = mysql_query($querystatement,$dblink); 
     148                if (!$insertresult) reportError(300,"Could not insert status history: ".mysql_error($dblink)." -- ".$querystatement);            
     149        } 
    89150 
    90151        return $message; 
  • trunk/phpbms/modules/bms/install/createtables.sql

    r183 r184  
    245245  PRIMARY KEY  (`id`) 
    246246) TYPE=MyISAM PACK_KEYS=0; 
     247 
     248CREATE TABLE `invoicestatuses` ( 
     249  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, 
     250  `name` VARCHAR(128), 
     251  `invoicedefault` TINYINT UNSIGNED NOT NULL DEFAULT 0, 
     252  `defaultassignedtoid` INTEGER UNSIGNED, 
     253  `inactive` TINYINT UNSIGNED NOT NULL DEFAULT 0, 
     254  `priority` INTEGER UNSIGNED NOT NULL DEFAULT 0, 
     255  `createdby` INTEGER UNSIGNED, 
     256  `creationdate` DATETIME, 
     257  `modifiedby` INTEGER UNSIGNED, 
     258  `modifieddate` TIMESTAMP, 
     259  PRIMARY KEY(`id`) 
     260) 
     261ENGINE = MYISAM; 
     262 
     263CREATE TABLE `invoicestatushistory` ( 
     264  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, 
     265  `invoicedefault` INTEGER UNSIGNED   
     266  `invoiceid` INTEGER UNSIGNED, 
     267  `invoicestatusid` INTEGER UNSIGNED, 
     268  `statusdate` DATE, 
     269  `assignedtoid` INTEGER UNSIGNED, 
     270  PRIMARY KEY(`id`) 
     271) 
     272ENGINE = MYISAM; 
  • trunk/phpbms/modules/bms/install/menu.sql

    r176 r184  
    1414INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (213,'Shipping Methods','search.php?id=300',204,30,1,1,NOW(),NOW(),30); 
    1515INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (214,'Payment Methods','search.php?id=301',204,40,1,1,NOW(),NOW(),30); 
     16INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (215,'----','',204,15,1,1,NOW(),NOW(),30); 
     17INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (216,'invoice statuses','search.php?id=302',204,50,1,1,NOW(),NOW(),30); 
  • trunk/phpbms/modules/bms/install/tablecolumns.sql

    r176 r184  
    6464INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (301,'priority','paymentmethods.priority','center','',3,'',0,'',NULL); 
    6565INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (301,'online process','paymentmethods.onlineprocess','center','',4,'',0,'','boolean'); 
     66INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'name','invoicestatuses.name','left','',0,'',1,'99%',NULL); 
     67INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'priority','invoicestatuses.priority','right','',1,'',0,'',NULL); 
     68INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'inactive','invoicestatuses.inactive','center','',2,'',0,'','boolean'); 
  • trunk/phpbms/modules/bms/install/tabledefs.sql

    r176 r184  
    11INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (22,'Client E-mail Projects','system',2,'clientemailprojects','clientemailprojects left join users on clientemailprojects.userid=users.id','modules/bms/clientemailprojects_edit.php',0,'NA',0,0,-100,-100,'delete','clientemailprojects.id !=-1','clientemailprojects.name','search','','',1,NOW(),1,NOW()); 
    22INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (2,'Clients/Prospects','table',2,'clients','clients','modules/bms/clients_addedit.php',0,'modules/bms/clients_addedit.php',0,0,-100,-100,'inactivate','clients.id=-100','concat(clients.lastname,\", \",clients.firstname)','','','',1,NOW(),1,NOW()); 
    3 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (3,'Quotes/Orders/Invoices','table',2,'invoices','(invoices inner join clients on invoices.clientid=clients.id)','modules/bms/invoices_addedit.php',0,'modules/bms/invoices_addedit.php',0,0,-100,-100,'void','invoices.type+0<3','invoices.id','','','',1,NOW(),1,NOW()); 
     3INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (3,'Quotes/Orders/Invoices','table',2,'invoices','((invoices inner join clients on invoices.clientid=clients.id) inner join invoicestatuses on invoices.statusid=invoicestatuses.id)','modules/bms/invoices_addedit.php',0,'modules/bms/invoices_addedit.php',0,0,-100,-100,'void','invoices.type+0<3','invoices.id','','','',1,NOW(),1,NOW()); 
    44INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (4,'Products','table',2,'products','(products inner join productcategories on products.categoryid=productcategories.id)','modules/bms/products_addedit.php',0,'modules/bms/products_addedit.php',0,0,-100,-100,'inactivate','products.id =-100','products.partnumber','','','',1,NOW(),1,NOW()); 
    55INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (5,'Line Items','table',2,'lineitems','((lineitems left join products on lineitems.productid=products.id) inner join invoices on lineitems.invoiceid=invoices.id)','N/A',0,'N/A',0,0,-100,-100,'NA','lineitems.id =-1','lineitems.invoiceid,lineitems.id','','','',1,NOW(),1,NOW()); 
     
    1111INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (300,'Shipping Methods','table',2,'shippingmethods','shippingmethods','modules/bms/shippingmethods_addedit.php',30,'modules/bms/shippingmethods_addedit.php',30,30,30,-100,'inactivate','shippingmethods.inactive!=0','shippingmethods.priority, shippingmethods.name','','','',1,NOW(),1,NOW()); 
    1212INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (301,'Payment Methods','table',2,'paymentmethods','paymentmethods','modules/bms/paymentmethods_addedit.php',30,'modules/bms/paymentmethods_addedit.php',30,30,30,-100,'inactivate','paymentmethods.inactive=0','paymentmethods.priority,paymentmethods.name','','','',1,NOW(),1,NOW()); 
     13INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (302,'Invoice Statuses','table',2,'invoicestatuses','invoicestatuses','modules/bms/invoicestatuses_addedit.php',30,'modules/bms/invoicestatuses_addedit.php',30,30,-100,-100,'inactivate','invoicestatuses.inactive=0','invoicestatuses.priority,invoicestatuses.name','','',''1,NOW(),1,NOW()); 
  • trunk/phpbms/modules/bms/install/tablefindoptions.sql

    r176 r184  
    99INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (103,3,'Invoices - This Year','invoices.type=\"Invoice\" AND YEAR(invoices.invoicedate)=YEAR(CURDATE())',17,30); 
    1010INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (104,3,'Invoices - Last Quarter','invoices.type=\"Invoice\" AND YEAR(invoices.invoicedate)=YEAR(DATE_SUB(CURDATE(),INTERVAL 3 MONTH)) and QUARTER(invoices.invoicedate)=QUARTER(DATE_SUB(CURDATE(),INTERVAL 3 MONTH))',16,30); 
    11 INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (106,3,'Orders - Committed','invoices.type=\"Order\" and invoices.status=\"Committed\"',3,0); 
    12 INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (107,3,'Orders - Open','invoices.type=\"Order\" and invoices.status=\"Open\"',2,0); 
     11INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (106,3,'Orders - Committed','invoices.type=\"Order\" and invoicestatuses.name=\"Committed\"',3,0); 
     12INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (107,3,'Orders - Open','invoices.type=\"Order\" and invoicestatuses.name=\"Open\"',2,0); 
    1313INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (49,3,'Invoices - Today','invoices.type=\"Invoice\" and invoices.invoicedate=curdate()',9,20); 
    1414INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (50,3,'Invoices - Yesterday','invoices.type=\"Invoice\" and invoices.invoicedate=date_sub(curdate(),INTERVAL 1 DAY)',10,20); 
    1515INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (45,3,'Invoices - This Month','invoices.type=\"Invoice\" and year(invoicedate)=year(curdate()) and month(invoicedate)=month(curdate())',13,30); 
    1616INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (22,3,'Orders','invoices.type=\"Order\"',1,0); 
    17 INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (23,3,'Orders - Packed','invoices.type=\"Order\" and invoices.status=\"Packed\"',4,0); 
    18 INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (24,3,'Orders - Shipped','invoices.type=\"Order\" and invoices.status=\"Shipped\"',5,0); 
     17INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (23,3,'Orders - Packed','invoices.type=\"Order\" and invoicestatuses.name=\"Packed\"',4,0); 
     18INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (24,3,'Orders - Shipped','invoices.type=\"Order\" and invoicestatuses.name=\"Shipped / Ready To Invoice\"',5,0); 
    1919INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (25,3,'Invoices','invoices.type=\"Invoice\"',8,30); 
    2020INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (26,3,'Quotes','invoices.type=\"Quote\"',7,20); 
     
    6262INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (301,'Active','paymentmethods.inactive=0',0,0); 
    6363INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (301,'Inactive','paymentmethods.inactive=1',1,0); 
     64INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (302,'Active Records','invoicestatuses.inactive=0',0,0); 
     65INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (302,'All Records','invoicestatuses.id!=-1',1,0); 
  • trunk/phpbms/modules/bms/install/tableoptions.sql

    r176 r184  
    5252INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (301,'edit','1',0,0); 
    5353INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (301,'printex','1',0,0); 
     54INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (302,'new','1',0,0); 
     55INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (302,'select','1',0,0); 
     56INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (302,'edit','1',0,0); 
     57INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (302,'printex','0',0,0); 
  • trunk/phpbms/modules/bms/install/tablesearchablefields.sql

    r176 r184  
    4242INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (300,'shippingmethods.name','name',0,'field'); 
    4343INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (301,'paymentmethods.name','name',0,'field'); 
     44INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (302,'invoicestatuses.name','name',0,'field'); 
  • trunk/phpbms/modules/bms/install/update.php

    r180 r184  
    278278                                case "0.62"; 
    279279                                        $thereturn.="Updating BMS Module to 0.7\n"; 
    280  
     280                                         
    281281                                        $thereturn.=processSQLfile("updatev0.7.sql"); 
     282                                         
     283                                        //update to new status system 
     284                                        if(updateInvoiceStatus($dblink)) 
     285                                                $thereturn.=" - Updated to new invoice status system\n."; 
     286                                        else 
     287                                                $thereturn.=" - Failed to updated to new invoice status system\n."; 
     288                                         
    282289                                         
    283290                                        //Update shipping from invoices 
     
    348355        } 
    349356 
     357        function updateInvoiceStatus($dblink){ 
     358                $querystatement="SELECT id,status,statusdate FROM invoices;"; 
     359                while($therecord=mysql_fetch_array($queryresult)){ 
     360                        $newstatus=1; 
     361                        switch(){ 
     362                                case "Open": 
     363                                        $newstatus=1; 
     364                                break; 
     365                                case "Committed": 
     366                                        $newstatus=2; 
     367                                break; 
     368                                case "Packed": 
     369                                        $newstatus=3; 
     370                                break; 
     371                                case "Shipped": 
     372                                        $newstatus=4; 
     373                                break; 
     374                        } 
     375                        $querystatement="UPDATE invoices SET statusid=".$newstatus." WHERE id=".$therecord["id"]; 
     376                        $updatequery=mysql_query($querystatement,$dblink); 
     377                         
     378                        //now create the history 
     379                        if($therecord["statusdate"]!="" && $newstatus=4) 
     380                                $querystatement="INSERT INTO invoicestatushistory (invoiceid,statusid,statusdate)VALUES(".$therecord["id"].",".$newstatus.",".$therecord["statusdate"].")"; 
     381                        elseif($therecord["statusdate"]!="" && $newstatus!=4){ 
     382                                $querystatement="INSERT INTO invoicestatushistory (invoiceid,statusid,statusdate)VALUES(".$therecord["id"].",4,".$therecord["statusdate"].")"; 
     383                                $insertquery=mysql_query($querystatement,$dblink); 
     384                                $querystatement="INSERT INTO invoicestatushistory (invoiceid,statusid)VALUES(".$therecord["id"].",".$newstatus.")"; 
     385                        } 
     386                        else 
     387                                $querystatement="INSERT INTO invoicestatushistory (invoiceid,statusid)VALUES(".$therecord["id"].",".$newstatus.")"; 
     388                        $insertquery=mysql_query($querystatement,$dblink); 
     389                         
     390                } 
     391                $querystatement="ALTER TABLE `invoices` DROP COLUMN `status`"; 
     392                $dropcolumnquery=mysql_query($querystatement,$dblink); 
     393                 
     394                return true; 
     395        } 
    350396 
    351397                $thereturn=doUpdate();   
  • trunk/phpbms/modules/bms/install/updatev0.70.sql

    r179 r184  
    4646ALTER TABLE `clients` ALTER COLUMN `shiptostate` `shiptostate` varchar(5) default NULL; 
    4747ALTER TABLE `invoices` ALTER COLUMN `state` `state` varchar(5) default NULL; 
     48CREATE TABLE `invoicestatuses` (`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,`name` VARCHAR(128), `invoicedefault` TINYINT UNSIGNED NOT NULL DEFAULT 0,`defaultassignedtoid` INTEGER UNSIGNED,`inactive` TINYINT UNSIGNED NOT NULL DEFAULT 0, `priority` INTEGER UNSIGNED NOT NULL DEFAULT 0, `createdby` INTEGER UNSIGNED, `creationdate` DATETIME, `modifiedby` INTEGER UNSIGNED, `modifieddate` TIMESTAMP, PRIMARY KEY(`id`))ENGINE = MYISAM; 
     49CREATE TABLE `invoicestatushistory` (`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `invoiceid` INTEGER UNSIGNED, `invoicestatusid` INTEGER UNSIGNED, `statusdate` DATE, `assignedtoid` INTEGER UNSIGNED, PRIMARY KEY(`id`))ENGINE = MYISAM; 
     50INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (302,'Invoice Statuses','table',2,'invoicestatuses','invoicestatuses','modules/bms/invoicestatuses_addedit.php',30,'modules/bms/invoicestatuses_addedit.php',30,30,-100,-100,'inactivate','invoicestatuses.inactive=0','invoicestatuses.priority,invoicestatuses.name','','',''1,NOW(),1,NOW()); 
     51INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (215,'----','',204,15,1,1,NOW(),NOW(),30); 
     52INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (216,'invoice statuses','search.php?id=302',204,50,1,1,NOW(),NOW(),30); 
     53INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'name','invoicestatuses.name','left','',0,'',1,'99%',NULL); 
     54INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'priority','invoicestatuses.priority','right','',1,'',0,'',NULL); 
     55INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (302,'inactive','invoicestatuses.inactive','center','',2,'',0,'','boolean'); 
     56INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (302,'Active Records','invoicestatuses.inactive=0',0,0); 
     57INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (302,'All Records','invoicestatuses.id!=-1',1,0); 
     58INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (302,'invoicestatuses.name','name',0,'field'); 
     59INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (302,'new','1',0,0); 
     60INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (302,'select','1',0,0); 
     61INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (302,'edit','1',0,0); 
     62INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (302,'printex','0',0,0); 
     63ALTER TABLE `invoices` CHANGE COLUMN `shippeddate` `statusdate` DATE DEFAULT NULL; 
     64ALTER TABLE `invoices` ADD COLUMN `statusid` INTEGER UNSIGNED AFTER `status`; 
     65ALTER TABLE `invoices` ADD COLUMN `assignedtoid` INTEGER UNSIGNED AFTER `statusid`; 
     66UPDATE `tabledefs` SET `querytable`='((invoices inner join clients on invoices.clientid=clients.id) inner join invoicestatuses on invoices.statusid=invoicestatuses.id)' WHERE `id` =3; 
     67UPDATE `tablefindoptions` SET `search`='invoices.type=\"Order\" and invoicestatuses.name=\"Shipped / Ready To Invoice\"' WHERE `id`=24; 
     68UPDATE `tablefindoptions` SET `search`='invoices.type=\"Order\" and invoicestatuses.name=\"Packed\"' WHERE `id`=23; 
     69UPDATE `tablefindoptions` SET `search`='invoices.type=\"Order\" and invoicestatuses.name=\"Committed\"' WHERE `id`=106; 
     70UPDATE `tablefindoptions` SET `search`='invoices.type=\"Order\" and invoicestatuses.name=\"Open\"' WHERE `id`=107; 
  • trunk/phpbms/modules/bms/invoices_addedit.php

    r178 r184  
    7676        </div> 
    7777        <h1 id="h1With<?php if(!$therecord["id"]) echo "out"?>Print"><?php echo $pageTitle ?></h1> 
    78          
    79          <fieldset id="fsAttributes"> 
    80                 <legend>attributes</legend> 
     78        <div id="fsAttributes"> 
     79                <fieldset > 
     80                        <legend>attributes</legend> 
     81                         
     82                        <div id="attributesRight"> 
     83                                <p> 
     84                                        <label for="orderdate">order date</label><br /> 
     85                                        <?php field_datepicker("orderdate",$therecord["orderdate"],0,"Order date must be a valid date",Array("size"=>"11","maxlength"=>"11","tabindex"=>"10"),false);?> 
     86                                </p> 
     87                                <p> 
     88                                        <label for="invoicedate">invoice date</label> 
     89                                        <br /> 
     90                                        <?php field_datepicker("invoicedate",$therecord["invoicedate"],0,"Invoice date must be a valid date",Array("size"=>"11","maxlength"=>"11","tabindex"=>"11"),false);?> 
     91                                </p> 
     92                                 
     93                                <p> 
     94                                        <label for="requireddate">required date</label> 
     95                                        <br /> 
     96                                        <?php field_datepicker("requireddate",$therecord["requireddate"],0,"Required date must be a valid date",Array("size"=>"11","maxlength"=>"11","tabindex"=>"13"),false);?> 
     97                                </p> 
     98                        </div> 
    8199                 
    82                 <div id="attributesRight"> 
    83                         <p> 
    84                                 <label for="orderdate">order date</label><br /> 
    85                                 <?php field_datepicker("orderdate",$therecord["orderdate"],0,"Order date must be a valid date",Array("size"=>"11","maxlength"=>"11","tabindex"=>"10"),false);?> 
    86                         </p> 
    87                         <p> 
    88                                 <label for="invoicedate">invoice date</label> 
    89                                 <br /> 
    90                                 <?php field_datepicker("invoicedate",$therecord["invoicedate"],0,"Invoice date must be a valid date",Array("size"=>"11","maxlength"=>"11","tabindex"=>"11"),false);?> 
    91                         </p> 
     100                        <div> 
     101                                <p> 
     102                                        <label for="id">id</label> 
     103                                        <br /> 
     104                                        <input name="id" id="id" type="text" value="<?php echo $therecord["id"]; ?>" size="11" maxlength="11" readonly="true" class="uneditable" tabindex="0"  /> 
     105                                </p> 
     106                                 
     107                                <p> 
     108                                <label for="type" class="important">type</label><br /> 
     109                                        <?php  if($therecord["type"]=="VOID" || $therecord["type"]=="Invoice") {?> 
     110                                                <input id="type" name="type" type="text" value="<?php echo htmlQuotes($therecord["type"])?>" size="11" maxlength="11" readonly="true" class="uneditable important" tabindex=9 /> 
     111                                        <?php }else { 
     112                                                $thechoices=array(); 
     113                                                $thechoices[]=array("name"=>"Quote","value"=>"Quote"); 
     114                                                $thechoices[]=array("name"=>"Order","value"=>"Order"); 
     115                                                if(hasRights(30)) $thechoices[]=array("name"=>"Invoice","value"=>"Invoice"); 
     116                                                $thechoices[]=array("name"=>"VOID","value"=>"VOID"); 
     117                                                basic_choicelist("type",$therecord["type"],$thechoices,array("onchange"=>"checkType(this)","class"=>"important","style"=>"width:90px","tabindex"=>"9")); 
     118                                        } 
     119                                        ?><input type="hidden" id="oldType" name="oldType" value="<?php echo $therecord["type"]?>"/> 
     120                                </p> 
     121                 
     122                                <p> 
     123                                        <label for="ponumber">client PO#</label> 
     124                                        <br /> 
     125                                        <input name="ponumber" id="ponumber" type="text" value="<?php echo htmlQuotes($therecord["ponumber"])?>" size="11" maxlength="64" tabindex=12 /> 
     126                                </p> 
     127                        </div> 
     128                         
    92129                         
    93130                        <p> 
    94                                 <label for="requireddate">required date</label> 
     131                                <label for="leadsource">lead source</label> 
    95132                                <br /> 
    96                                 <?php field_datepicker("requireddate",$therecord["requireddate"],0,"Required date must be a valid date",Array("size"=>"11","maxlength"=>"11","tabindex"=>"13"),false);?> 
    97                         </p> 
    98  
     133                                <?php choicelist("leadsource",$therecord["leadsource"],"leadsource",Array("tabindex"=>"14")); ?>                         
     134                        </p> 
     135                </fieldset> 
     136                <fieldset> 
     137                        <legend>Status</legend> 
    99138                        <p> 
    100                                 <label for="shippeddate">shipped date</label> 
    101                                 <br /> 
    102                                 <?php field_datepicker("shippeddate",$therecord["shippeddate"],0,"Shipped date must be a valid date.",Array("size"=>"11","maxlength"=>"11","tabindex"=>"14"),false); ?>                  
    103                         </p> 
    104                 </div> 
    105  
    106                 <div> 
     139                                <label for="statusid" class="important">current status</label><br /> 
     140                                <?php displayStatusDropDown($therecord["statusid"],$dblink)?> 
     141                                <input type="hidden" id="statuschanged" name="statuschanged" value="<?php if($therecord["id"]=="") echo "1"; else echo "0"?>" /> 
     142                        </p> 
    107143                        <p> 
    108                                 <label for="id">id</label> 
    109                                 <br /> 
    110                                 <input name="id" id="id" type="text" value="<?php echo $therecord["id"]; ?>" size="11" maxlength="11" readonly="true" class="uneditable" tabindex="0"  /> 
    111                         </p> 
    112                          
     144                                <label for="statusdate">status date</label><br /> 
     145                                <?PHP field_datepicker("statusdate",$therecord["statusdate"],0,"Status date must be a valid date",Array("size"=>"11","maxlength"=>"11","tabindex"=>"13","onchange"=>"updateStatusChange();"),false);?> 
     146                        </p> 
    113147                        <p> 
    114                         <label for="type" class="important">type</label><br /> 
    115                                 <?php  if($therecord["type"]=="VOID" || $therecord["type"]=="Invoice") {?> 
    116                                         <input id="type" name="type" type="text" value="<?php echo htmlQuotes($therecord["type"])?>" size="11" maxlength="11" readonly="true" class="uneditable important" tabindex=9 /> 
    117                                 <?php }else { 
    118                                         $thechoices=array(); 
    119                                         $thechoices[]=array("name"=>"Quote","value"=>"Quote"); 
    120                                         $thechoices[]=array("name"=>"Order","value"=>"Order"); 
    121                                         if(hasRights(30)) $thechoices[]=array("name"=>"Invoice","value"=>"Invoice"); 
    122                                         $thechoices[]=array("name"=>"VOID","value"=>"VOID"); 
    123                                         basic_choicelist("type",$therecord["type"],$thechoices,array("onchange"=>"checkType(this)","class"=>"important","style"=>"width:90px","tabindex"=>"9")); 
    124                                 } 
    125                                 ?><input type="hidden" id="oldType" name="oldType" value="<?php echo $therecord["type"]?>"/> 
    126                         </p> 
    127  
    128                         <p> 
    129                                 <label for="ponumber">client PO#</label> 
    130                                 <br /> 
    131                                 <input name="ponumber" id="ponumber" type="text" value="<?php echo htmlQuotes($therecord["ponumber"])?>" size="11" maxlength="64" tabindex=12 /> 
    132                         </p> 
    133                 </div> 
     148                                <label for="assignedtoid">assigned to</label><br /> 
     149                                <?php autofill("assignedtoid",$therecord["assignedtoid"],9,"users.id","concat(users.firstname,\" \",users.lastname)","\"\"","users.revoked!=1",Array("size"=>"30","maxlength"=>"128")) ?> 
     150                        </p> 
    134151                 
    135                 <p> 
    136                         <strong>order status</strong><br /> 
    137                         <input type="radio" name="status" id="statusOpen" value="Open" <?php if($therecord["status"]=="Open") echo "checked"?> class="radiochecks" align="baseline" tabindex="13"/><label for="statusOpen">open</label><br /> 
    138                         <input type="radio" name="status" id="statusCommited" value="Committed" <?php if($therecord["status"]=="Committed") echo "checked"?> class="radiochecks" align="baseline" tabindex="13"/><label for="statusCommited">committed</label><br /> 
    139                         <input type="radio" name="status" id="statusPacked" value="Packed" <?php if($therecord["status"]=="Packed") echo "checked"?> class="radiochecks" align="baseline" tabindex="13"/><label for="statusPacked">packed</label><br /> 
    140                         <input type="radio" name="status" id="statusShipped" value="Shipped" <?php if($therecord["status"]=="Shipped") echo "checked"?> class="radiochecks" align="baseline" tabindex="13" onClick="setShipped()"/><label for="statusShipped">shipped/invoice</label> 
    141                 </p> 
    142                  
    143                 <p> 
    144                         <label for="leadsource">lead source</label> 
    145                         <br /> 
    146                         <?php choicelist("leadsource",$therecord["leadsource"],"leadsource",Array("tabindex"=>"14")); ?>                         
    147                 </p> 
    148         </fieldset> 
     152                </fieldset> 
     153        </div> 
    149154         
    150155        <div id="fsTops"> 
    151156                <fieldset > 
    152157                        <legend><label for="ds-clientid">client</label></legend> 
    153                         <div class="important fauxP"> 
     158                        <div class="important fauxP"><br /> 
    154159                                  <?php autofill("clientid",$therecord["clientid"],2,"clients.id","if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)","if(clients.city!=\"\",concat(clients.city,\", \",clients.state),\"\")","clients.inactive!=1 AND clients.type=\"client\"",Array("size"=>"45","maxlength"=>"128","style"=>"","style"=>"font-weight:bold","tabindex"=>"1"),1,"The record must have a client chosen.") ?> 
    155160                                  <script language="JavaScript" type="text/javascript"> 
     
    164169                <fieldset> 
    165170                        <legend><label for="address1">shipping address</label></legend>          
    166                         <p> 
     171                        <p><br /> 
    167172                                <input name="address1" id="address1" type="text" value="<?php echo htmlQuotes($therecord["address1"])?>" size="65" maxlength="128" tabindex=3 /><br /> 
    168173                                <input name="address2" id="address2" type="text"  value="<?php echo htmlQuotes($therecord["address2"])?>" size="65" maxlength="128" tabindex="4" /> 
     
    188193                <fieldset> 
    189194                        <legend>web / confirmation number</legend> 
    190                         <p> 
     195                        <p><br /> 
    191196                                <?php field_checkbox("weborder",$therecord["weborder"],0,array("tabindex"=>"14"));?> 
    192197                                <input name="webconfirmationno" type="text" value="<?php echo $therecord["webconfirmationno"] ?>" size="41" maxlength="64" tabindex="14" /> 
    193198                        </p> 
     199                        <p>&nbsp;</p> 
    194200                </fieldset> 
    195201        </div> 
     
    279285                                        <p> 
    280286                                                <label for="taxpercentage">tax percentage</label><br /> 
    281                                                 <?php field_percentage("taxpercentage",$therecord["taxpercentage"],5,0,"Tax percentage must be a valid percentage.",Array("size"=>"9","maxlength"=>"9","onChange"=>"clearTaxareaid()","tabindex"=>"22")); ?>                                             
     287                                                <?php field_percentage("taxpercentage",$therecord["taxpercentage"],5,0,"Tax percentage must be a valid percentage.",Array("size"=>"9","maxlength"=>"9","onchange"=>"clearTaxareaid()","tabindex"=>"22")); ?>                                             
    282288                                        </p> 
    283289                                </fieldset> 
  • trunk/phpbms/modules/bms/invoices_lineitem_ajax.php

    r145 r184  
    5858                        (clients inner join invoices on clients.id=invoices.clientid)  
    5959                        inner join lineitems on invoices.id = lineitems.invoiceid 
    60                         where clients.id=".$_GET["cid"]." and invoices.status != \"Void\" and invoices.status != \"Quote\" and 
     60                        where clients.id=".$_GET["cid"]." and invoices.type != \"Void\" and invoices.type != \"Quote\" and 
    6161                        (".$checkpids.")"; 
    6262                $prquery=mysql_query($prlookupstatement,$dblink); 
  • trunk/phpbms/modules/bms/javascript/invoice.js

    r176 r184  
    5555                displayClient.focus(); 
    5656        } 
    57 } 
     57         
     58        var clientinfo=getObjectFromID("clientid"); 
     59        clientinfo.onchange=populateShipping; 
     60         
     61        var assignedtoid=getObjectFromID("assignedtoid"); 
     62        assignedtoid.onchange=updateStatusChange; 
     63} 
     64 
     65function updateAssignedTo(){ 
     66        var status=getObjectFromID("statusid"); 
     67        var assignedto=getObjectFromID("ds-assignedtoid"); 
     68        if(statusAssignedto["s"+status.value]){ 
     69                assignedto.value=statusAssignedto["s"+status.value] 
     70                lastLookup(assignedto); 
     71        } 
     72} 
     73 
     74function updateStatusChange(){ 
     75        var statuschanged=getObjectFromID("statuschanged"); 
     76        statuschanged.value=1; 
     77} 
     78 
     79function updateStatusDate(){ 
     80        var statusdate=getObjectFromID("statusdate"); 
     81        var today=new Date(); 
     82        statusdate.value=englishDate(today); 
     83         
     84        updateStatusChange(); 
     85} 
     86 
    5887 
    5988function payInFull(){ 
     
    6493} 
    6594 
    66 // These function are used when redefining the onChange property of  
     95// These function are used when redefining the onchange property of  
    6796// a hidden field for the the taxAreaID.  It uses XMLHttpRequest to 
    6897// grab the tax percentage. 
     
    149178} 
    150179 
    151 // This function is used when redefining the onChange property of  
     180// This function is used when redefining the onchange property of  
    152181// a hidden field for the the client ID.  It will then open a small window 
    153182// passing the client ID, and retrieve the appropriate shipping info 
  • trunk/phpbms/modules/bms/products_addedit.php

    r155 r184  
    121121                        <p> 
    122122                                <label for="partnumber"><span class="important">part number</span> <span class="notes">(must be unique)</span></label><br /> 
    123                                 <?php field_text("partnumber",$therecord["partnumber"],1,"Part number name cannot be blank.","",Array("size"=>"20","maxlength"=>"32","class"=>"important","tabindex"=>"20","onChange"=>"checkUnique('../../',this.value,this.name,'products','partnumber','".$therecord["id"]."')")); ?>                                 
     123                                <?php field_text("partnumber",$therecord["partnumber"],1,"Part number name cannot be blank.","",Array("size"=>"20","maxlength"=>"32","class"=>"important","tabindex"=>"20","onchange"=>"checkUnique('../../',this.value,this.name,'products','partnumber','".$therecord["id"]."')")); ?>                                 
    124124                        </p> 
    125125                         
     
    240240                                <input type="hidden" id="thumbchange" name="thumbchange" value="" /> 
    241241                                <div id="thumbdelete" style="display:<?php if($therecord["thumbnailmime"]) echo "block"; else echo "none";?>"><input type="button" class="Buttons" value="delete thumbnail" onClick="deletePicture('thumb')" tabindex="260"/></div> 
    242                                 <div id="thumbadd" style="display:<?php if($therecord["thumbnailmime"]) echo "none"; else echo "block";?>"><input id="thumbnailupload" name="thumbnailupload" type="file" size="40" onChange="updatePictureStatus('thumb','upload')" tabindex="260" /></div> 
     242                                <div id="thumbadd" style="display:<?php if($therecord["thumbnailmime"]) echo "none"; else echo "block";?>"><input id="thumbnailupload" name="thumbnailupload" type="file" size="40" onchange="updatePictureStatus('thumb','upload')" tabindex="260" /></div> 
    243243                        </div> 
    244244 
     
    253253                                <input type="hidden" id="picturechange" name="picturechange" value="" /> 
    254254                                <div id="picturedelete" style="display:<?php if($therecord["picturemime"]) echo "block"; else echo "none";?>"><input type="button" class="Buttons" value="delete picture" onClick="deletePicture('picture')" tabindex="270"/></div>                              
    255                                 <div id="pictureadd" style="display:<?php if($therecord["picturemime"]) echo "none"; else echo "block";?>"><input id="pictureupload" name="pictureupload" type="file" size="40" onChange="updatePictureStatus('picture','upload')" tabindex="270"/></div>                                
     255                                <div id="pictureadd" style="display:<?php if($therecord["picturemime"]) echo "none"; else echo "block";?>"><input id="pictureupload" name="pictureupload" type="file" size="40" onchange="updatePictureStatus('picture','upload')" tabindex="270"/></div>                                
    256256                        </div> 
    257257                </div> 
  • trunk/phpbms/modules/bms/products_saleshistory.php

    r170 r184  
    113113</head> 
    114114<body><?php include("../../menu.php")?> 
    115 <?php product_tabs("Sales History",$_GET["id"]);?><div class="bodyline" style="padding:4px;"> 
     115<?php product_tabs("Sales History",$_GET["id"]);?><div class="bodyline"> 
    116116        <h1><span><?php echo $pageTitle ?></span></h1> 
    117117        <form action="<?php echo $_SERVER["REQUEST_URI"] ?>" method="post" name="record">                
    118118        <div class="box"> 
    119119                <p class="timelineP"> 
    120                    <label for="status">invoice status</label><br /> 
     120                   <label for="status">type</label><br /> 
    121121                   <select name="status" id="status"> 
    122122                                <option value="Orders/Invoices" <?php if($_POST["status"]=="Orders/Invoices") echo "selected"?>>Orders/Invoices</option> 
  • trunk/phpbms/modules/bms/report/invoices_totals.php

    r176 r184  
    410410                                                        <option value="invoices.shipstate">Shipping State</option> 
    411411                                                        <option value="invoices.shipcity">Shipping City</option> 
    412                                                         <option value="invoices.status">Invoice Status</option> 
    413412                                                        <option value="invoices.weborder">Web Orders</option>                                            
    414413                                                </select> 
  • trunk/phpbms/modules/bms/snapshot.php

    r170 r184  
    8585        global $dblink; 
    8686        $querystatement="SELECT invoices.id, 
    87                                         invoices.status, 
     87                                        invoicestatuses.name as status, 
    8888                                        if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company) as thename, 
    8989                                        invoices.totalti as total, 
    9090                                        invoices.totalti-invoices.amountpaid as amtdue 
    91                                         FROM invoices INNER JOIN clients ON invoices.clientid=clients.id 
     91                                        FROM (invoices INNER JOIN clients ON invoices.clientid=clients.id) INNER JOIN invoicestatuses on invoices.statusid=invoicestatuses.id 
    9292                                        WHERE invoices.creationdate>= DATE_SUB(NOW(),INTERVAL ".$interval.") AND (invoices.type=\"Order\") 
    9393                                        ORDER BY invoices.creationdate DESC LIMIT 0,50 
  • trunk/phpbms/print.php

    r170 r184  
    195195                        <p> 
    196196                                <label class="important" for="therecords">from</label><br /> 
    197                                 <select id="therecords" name="therecords" onChange="showSavedSearches(this);"> 
     197                                <select id="therecords" name="therecords" onchange="showSavedSearches(this);"> 
    198198                                        <option value="selected">selected records (<?php echo count($tablePrinter->theids) ?> record<?php if(count($tablePrinter->theids)>1) echo "s"?>)</option> 
    199199                                        <option value="savedsearch">saved search...</option> 
     
    221221                        <p class="important"> 
    222222                                <label for="thesort">by</label><br /> 
    223                                 <select id="thesort" name="thesort" onChange="showSortOptions(this)"> 
     223                                <select id="thesort" name="thesort" onchange="showSortOptions(this)"> 
    224224                                        <option value="default" selected>report default</option> 
    225225                                        <option value="single">single field</option> 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.