Changeset 192
- Timestamp:
- 02/22/07 17:58:16
- Files:
-
- trunk/phpbms/common/javascript/common.js (modified) (3 diffs)
- trunk/phpbms/common/javascript/fields.js (modified) (3 diffs)
- trunk/phpbms/common/stylesheet/mozilla/forms.css (modified) (1 diff)
- trunk/phpbms/common/stylesheet/mozilla/queryresults.css (modified) (1 diff)
- trunk/phpbms/include/common_functions.php (modified) (4 diffs)
- trunk/phpbms/include/fields.php (modified) (2 diffs)
- trunk/phpbms/include/jstransport.php (modified) (1 diff)
- trunk/phpbms/install/settings.sql (modified) (1 diff)
- trunk/phpbms/install/updatev0.7.sql (modified) (1 diff)
- trunk/phpbms/modules/base/adminsettings.php (modified) (2 diffs)
- trunk/phpbms/modules/base/include/notes_addedit_include.php (modified) (1 diff)
- trunk/phpbms/modules/base/javascript/notes.js (modified) (3 diffs)
- trunk/phpbms/modules/bms/discounts_addedit.php (modified) (2 diffs)
- trunk/phpbms/modules/bms/include/discounts_addedit_include.php (modified) (2 diffs)
- trunk/phpbms/modules/bms/include/invoices_addedit_include.php (modified) (6 diffs)
- trunk/phpbms/modules/bms/include/products_addedit_include.php (modified) (2 diffs)
- trunk/phpbms/modules/bms/invoices_addedit.php (modified) (1 diff)
- trunk/phpbms/modules/bms/javascript/client.js (modified) (1 diff)
- trunk/phpbms/modules/bms/javascript/invoice.js (modified) (12 diffs)
- trunk/phpbms/modules/bms/javascript/product.js (modified) (1 diff)
- trunk/phpbms/modules/bms/products_addedit.php (modified) (2 diffs)
- trunk/phpbms/modules/bms/quickview_ajax.php (modified) (1 diff)
- trunk/phpbms/modules/bms/report/invoices_pdfinvoice.php (modified) (2 diffs)
- trunk/phpbms/modules/bms/report/invoices_pdfpackinglist.php (modified) (1 diff)
- trunk/phpbms/modules/bms/report/invoices_pdfquote.php (modified) (1 diff)
- trunk/phpbms/modules/bms/report/invoices_pdfworkorder.php (modified) (2 diffs)
- trunk/phpbms/modules/bms/snapshot.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phpbms/common/javascript/common.js
r191 r192 179 179 } 180 180 181 function englishTime(thedate){182 var ampm = " AM";183 var hours = thedate.getHours()184 if(hours==0) hours=12;185 if (hours>12){186 var ampm = " PM";187 hours=hours-12188 }189 var minutes=thedate.getMinutes();190 if(minutes<10)191 minutes="0"+minutes;192 return hours+":"+minutes+ampm;193 }194 195 function englishDate(thedate){196 return (thedate.getMonth()+1)+"/"+thedate.getDate()+"/"+thedate.getFullYear();197 }198 199 function dateFromField(englishdate,englishtime){200 var theyear= parseInt(englishdate.substring(englishdate.lastIndexOf("/")+1),10);201 var themonth= parseInt(englishdate.substring(0,englishdate.indexOf("/")),10)-1;202 var theday= parseInt(englishdate.substring(englishdate.indexOf("/")+1,englishdate.lastIndexOf("/")),10);203 var thedate= new Date(theyear,themonth,theday);204 if(englishtime){205 var thehour=parseInt(englishtime.substring(0,englishtime.indexOf(":")),10);206 var theminute=parseInt(englishtime.substring(englishtime.indexOf(":")+1,englishtime.indexOf(" ")),10);207 var AMPM=englishtime.substring(englishtime.indexOf(" ")+1);208 if(AMPM=="PM" && thehour!=12)209 thehour+=12;210 else if (AMPM=="AM" && thehour==12)211 thehour=0;212 thedate.setHours(thehour,theminute);213 }214 return thedate;215 }216 181 217 182 /* DATE AND TIME --------------------------------------------------------------- */ 218 183 /* ----------------------------------------------------------------------------- */ 184 function stringToDatetime(sDate,sTime){ 185 thedate=stringToDate(sDate) 186 if(sTime){ 187 var thetime=stringToTime(sTime); 188 thedate.setHours(thetime.getHours()); 189 thedate.setMinutes(thetime.getMinutes()); 190 thedate.setSeconds(thetime.getSeconds()); 191 } 192 return thedate; 193 } 194 219 195 function stringToDate(sDate,format){ 220 196 if (!format) format=DATE_FORMAT; … … 253 229 if(thedate){ 254 230 var sep; 231 var month; 232 var day; 255 233 switch(format){ 256 234 case "SQL": 257 sep="-"; 258 sdate= thedate.getFullYear()+sep+(thedate.getMonth()+1)+sep+thedate.getDate(); 235 sep="-"; 236 month=thedate.getMonth()+1; 237 if(month<10) month="0"+month; 238 day=thedate.getDate(); 239 if(day<10) day="0"+day; 240 sdate= thedate.getFullYear()+sep+month+sep+day; 259 241 break; 260 242 261 243 case "English, US": 262 244 sep="/"; 263 sdate= (thedate.getMonth()+1)+sep+thedate.getDate()+sep+thedate.getFullYear(); 245 month=thedate.getMonth()+1; 246 if(month<10) month="0"+month; 247 day=thedate.getDate(); 248 if(day<10) day="0"+day; 249 sdate= month+sep+day+sep+thedate.getFullYear(); 264 250 break; 265 251 } … … 329 315 return sTime; 330 316 } 317 /* CURRENCY -------------------------------------------------------------------- */ 318 /* ----------------------------------------------------------------------------- */ 319 function numberToCurrency(number){ 320 var currency=""; 321 if(isNaN(parseFloat(number))) number=0; 322 323 if(number<0) 324 currency+="-"; 325 number=Math.abs(number); 326 currency+=CURRENCY_SYMBOL; 327 if(number>0 && number <0) 328 currency+="0"; 329 330 var withThousands=parseInt(number).toString(); 331 var objRegExp = new RegExp('(-?[0-9]+)([0-9]{3})'); 332 while(objRegExp.test(withThousands)) 333 withThousands = withThousands.replace(objRegExp, '$1'+THOUSANDS_SEPARATOR+'$2'); 334 335 var lessthanone=Math.round((number-Math.round(number))*(Math.pow(10,CURRENCY_ACCURACY))).toString(); 336 while(lessthanone.length<CURRENCY_ACCURACY) 337 lessthanone="0"+lessthanone; 338 currency+=withThousands; 339 if(CURRENCY_ACCURACY!=0) 340 currency+=DECIMAL_SYMBOL+lessthanone; 341 return currency; 342 } 343 344 function currencyToNumber(currency){ 345 var number=0; 346 var thousSep=THOUSANDS_SEPARATOR; 347 if(thousSep=="." || thousSep=="*" || thousSep=="[" || thousSep=="]" || thousSep=="-" || thousSep=="+") 348 thousSep="\\"+thousSep; 349 var objRegExp = new RegExp(thousSep,"g"); 350 currency=currency.replace(objRegExp,""); 351 currency=currency.replace(CURRENCY_SYMBOL,""); 352 currency=currency.replace(DECIMAL_SYMBOL,"."); 353 if(currency) 354 number=parseFloat(currency); 355 return number 356 } 331 357 332 358 /* MODAL ----------------------------------------------------------------------- */ trunk/phpbms/common/javascript/fields.js
r191 r192 218 218 // checks and formats a field to dollars 219 219 function validateCurrency(theitem){ 220 var theCurrency=theitem.value; 221 var i; 222 var thenumber=""; 223 var newdollar; 224 225 for(i=0;i<theCurrency.length;i++){ 226 if (theCurrency.charAt(i)!="$" && theCurrency.charAt(i)!="+" && theCurrency.charAt(i)!=",") thenumber=thenumber+theCurrency.charAt(i); 227 } 228 //if the first number is a ".", add a 0 229 if (thenumber.charAt(0)==".") thenumber="0"+thenumber; 230 231 //get rid of trailing zeros and possibly "." 232 while(thenumber.charAt(thenumber.length-1)=="0" && thenumber.indexOf(".")!=-1) thenumber=thenumber.substring(0,thenumber.length-1); 233 if(thenumber.charAt(thenumber.length-1)==".") thenumber=thenumber.substring(0,thenumber.length-1); 234 235 theitem.value=formatCurrency(thenumber); 220 theitem.value=numberToCurrency(thenumber); 236 221 237 222 //in case the field has an additional onchange code to be run … … 246 231 } 247 232 248 function formatCurrency(thenumber){249 var newdollar,retval250 thenumber=thenumber.toString();251 //check for number252 if (isNaN(parseFloat(thenumber)) || thenumber.length!=((parseFloat(thenumber)).toString()).length) thenumber="0.00";253 254 // add the dollar sign... remember that if it is a negative number, the minus sign goes in front255 if(thenumber.charAt(0)=="-") {256 newdollar="-$";257 thenumber=thenumber.substring(1,thenumber.length);258 } else newdollar="$";259 260 var big_string = ""+(Math.round(100*(Math.abs(thenumber)))) //rounding the absolute value times 100261 var biglen = big_string.length //how the string gets handled depends on its length262 if (biglen == 0) //null263 {retval = "0.00"}264 else if (biglen == 1) //1 to 9 (.01 to .09 cents)265 {retval = "0.0"+big_string}266 else if (biglen == 2) //10 to 99 (.10 to .99 cents)267 {retval = "0."+big_string}268 else { //all cases above 100 ($1.00)269 //The substring method returns all characters in the string270 // starting with and including the the first argument,271 // up to but not including the second argument.272 var hundredths_digit = big_string.substring(biglen-1,biglen)273 var tenths_digit = big_string.substring(biglen-2,biglen-1)274 var integer_digits = big_string.substring(0,biglen-2)275 // commafy, borrowed from Danny Goodman, "Javascript Bible"276 var re = /(-?\d+)(\d{3})/277 while (re.test(integer_digits)) {278 integer_digits = integer_digits.replace(re, "$1,$2")279 }280 retval = integer_digits + "." + tenths_digit + hundredths_digit281 }282 newdollar = newdollar+retval;283 284 return newdollar;285 }286 287 function currencyToNumber(thecurrency){288 var i;289 var thenumber="";290 for(i=0;i<thecurrency.length;i++){291 if (thecurrency.charAt(i)!="$" && thecurrency.charAt(i)!="+" && thecurrency.charAt(i)!=",") thenumber=thenumber+thecurrency.charAt(i);292 }293 //if the first number is a ".", add a 0294 if (thenumber.charAt(0)==".") thenumber="0"+thenumber;295 296 //get rid of trailing zeros and possibly "."297 while(thenumber.charAt(thenumber.length-1)=="0" && thenumber.indexOf(".")!=-1) thenumber=thenumber.substring(0,thenumber.length-1);298 if(thenumber.charAt(thenumber.length-1)==".") thenumber=thenumber.substring(0,thenumber.length-1);299 300 if (isNaN(parseFloat(thenumber)) || thenumber.length!=((parseFloat(thenumber)).toString()).length) thenumber="0.00";301 302 thenumber=parseFloat(thenumber);303 return thenumber;304 }305 306 307 function processUniqueReqChange(){308 if (req.readyState == 4) {309 // only if "OK"310 if (req.status == 200) {311 var response = req.responseXML.documentElement;312 var thename = response.getElementsByTagName('name')[0].firstChild.data;313 var isunique = response.getElementsByTagName('isunique')[0].firstChild.data;314 315 if(isunique==0)316 alert("This field requires a unique value.<br/><br/>Another record already exists with this value.");317 }318 }319 }320 233 321 234 function getNumberFromPercentage(thenumber){ … … 337 250 338 251 var theurl=path+"checkunique.php?value="+encodeURIComponent(thevalue); 339 theurl=theurl+"&table="+ thetable;340 theurl=theurl+"&name="+ thename;341 theurl=theurl+"&field="+ thefield;342 theurl=theurl+"&excludeid="+ excludeid;252 theurl=theurl+"&table="+encodeURIComponent(thetable); 253 theurl=theurl+"&name="+encodeURIComponent(thename); 254 theurl=theurl+"&field="+encodeURIComponent(thefield); 255 theurl=theurl+"&excludeid="+parseInt(excludeid); 343 256 344 257 loadXMLDoc(theurl,processUniqueReqChange,true); trunk/phpbms/common/stylesheet/mozilla/forms.css
r176 r192 14 14 FORM{margin:0px;padding:0px;} 15 15 16 16 .currency{text-align:right;} 17 17 .uneditable,.uneditable:Focus {background-color:transparent; border-color:#ABB1B1;color:#666666;} 18 18 .disabledtext{color:#CCCCCC;} trunk/phpbms/common/stylesheet/mozilla/queryresults.css
r145 r192 41 41 42 42 .querytable td.queryfooter, .queryfooter{ 43 white-space:nowrap; 43 44 background:#BBBBBB; 44 45 border:1px solid #999999; trunk/phpbms/include/common_functions.php
r191 r192 132 132 133 133 // date/time functions 134 // It will add the quotes for you.135 134 //===================================================================== 136 135 define("DATE_FORMAT",$_SESSION["date_format"]); … … 308 307 } 309 308 309 // Currency functions 310 //===================================================================== 311 function numberToCurrency($number){ 312 $currency=""; 313 if($number<0) 314 $currency.="-"; 315 $currency.=$_SESSION["currency_symbol"].number_format(abs($number),$_SESSION["currency_accuracy"],$_SESSION["decimal_symbol"],$_SESSION["thousands_separator"]); 316 return $currency; 317 } 318 319 function currencyToNumber($currency){ 320 $number=str_replace($_SESSION["currency_symbol"],"",$currency); 321 $number=str_replace($_SESSION["thousands_separator"],"",$number); 322 $number=str_replace($_SESSION["decimal_symbol"],".",$number); 323 $number=((real) $number); 324 325 return $number; 326 } 327 328 310 329 311 330 //============================================================================ … … 371 390 } 372 391 373 function currencyFormat($number){374 if(!is_numeric($number)) return $number;375 if($number <0)376 $thenumber="-$".number_format(abs($number),2);377 else378 $thenumber="$".number_format($number,2);379 return $thenumber;380 }381 382 392 function booleanFormat($bool){ 383 393 if($bool==1) … … 391 401 switch($format){ 392 402 case "currency": 393 $value= currencyFormat($value);403 $value=numberToCurrency($value); 394 404 break; 395 405 case "boolean": trunk/phpbms/include/fields.php
r191 r192 235 235 236 236 //============================================================================================ 237 function field_ dollar($name,$value=0,$required=false,$message="",$attributes="") {238 /* 239 name = Name of the field 240 value = Value for field 237 function field_currency($name,$value=0,$required=false,$message="",$attributes="") { 238 /* 239 name = Name of the field 240 value = Value for field 241 241 required = true/false wether the field is validated by javascript before submitting for blank values 242 242 message = message displayed if not validate … … 246 246 247 247 if(!is_numeric($value)) $value=0; 248 $value= currencyFormat($value);248 $value=numberToCurrency($value); 249 249 250 250 ?><input name="<?php echo $name?>" id="<?php echo $name?>" type="text" value="<?php echo $value?>" <?php 251 if ($attributes) foreach($attributes as $attribute => $tvalue) echo " ".$attribute."=\"".$tvalue."\""; 252 ?> onchange="validateCurrency(this);" style="text-align:right;" /><?php 251 if ($attributes) 252 foreach($attributes as $attribute => $tvalue) 253 if($attribute!="onchange" && $attribute!="class")echo " ".$attribute."=\"".$tvalue."\""; 254 ?> onchange="validateCurrency(this);<?php if(isset($attributes["onchange"])) echo $attributes["onchange"] ?>" class="currency<?php if(isset($attributes["class"])) echo " ".$attributes["class"] ?>" /><?php 255 253 256 if ($required) {?><script language="JavaScript" type="text/javascript">requiredArray[requiredArray.length]=new Array('<?php echo $name?>','<?php echo $message?>');</script><?php }//end required if 254 257 } trunk/phpbms/include/jstransport.php
r191 r192 23 23 ?>TIME_FORMAT="<?php echo $_SESSION["time_format"]?>";<?php 24 24 echo "\n\n"; 25 26 //currency formating 27 ?>CURRENCY_SYMBOL="<?php echo $_SESSION["currency_symbol"]?>";<?php 28 echo "\n"; 29 ?>CURRENCY_ACCURACY=<?php echo $_SESSION["currency_accuracy"]?>;<?php 30 echo "\n"; 31 ?>DECIMAL_SYMBOL="<?php echo $_SESSION["decimal_symbol"]?>";<?php 32 echo "\n"; 33 ?>THOUSANDS_SEPARATOR="<?php echo $_SESSION["thousands_separator"]?>";<?php 34 echo "\n"; 35 25 36 26 37 if(isset($_SESSION["include_js"])){ trunk/phpbms/install/settings.sql
r191 r192 11 11 INSERT INTO `settings` (`name`, `value`) VALUES ('date_format','English, US'); 12 12 INSERT INTO `settings` (`name`, `value`) VALUES ('time_format','12 Hour'); 13 INSERT INTO `settings` (`name`, `value`) VALUES ('currency_symbol','$'); 14 INSERT INTO `settings` (`name`, `value`) VALUES ('decimal_symbol','.'); 15 INSERT INTO `settings` (`name`, `value`) VALUES ('thousands_separator',','); 16 INSERT INTO `settings` (`name`, `value`) VALUES ('currency_accuracy','2'); trunk/phpbms/install/updatev0.7.sql
r191 r192 63 63 INSERT INTO `settings` (`name`, `value`) VALUES ('date_format','English, US'); 64 64 INSERT INTO `settings` (`name`, `value`) VALUES ('time_format','12 Hour'); 65 INSERT INTO `settings` (`name`, `value`) VALUES ('currency_symbol','$'); 66 INSERT INTO `settings` (`name`, `value`) VALUES ('decimal_symbol','.'); 67 INSERT INTO `settings` (`name`, `value`) VALUES ('thousands_separator',','); trunk/phpbms/modules/base/adminsettings.php
r191 r192 113 113 <p> 114 114 <label for="sencryption_seed">encryption seed</label><br /> 115 <?php field_text("sencryption_seed",$_SESSION["encryption_seed"],1," Applicationname cannot be blank.","",Array("size"=>"32","maxlength"=>"128","readonly"=>"readonly","class"=>"uneditable")); ?>115 <?php field_text("sencryption_seed",$_SESSION["encryption_seed"],1,"Encryption seed name cannot be blank.","",Array("size"=>"32","maxlength"=>"128","readonly"=>"readonly","class"=>"uneditable")); ?> 116 116 </p> 117 117 … … 211 211 </select> 212 212 </p> 213 213 <p> </p> 214 <p> 215 <label for="scurrency_symbol">currency symbol</label><br /> 216 <?php field_text("scurrency_symbol",$_SESSION["currency_symbol"],1,"Currency symbol name cannot be blank.","",Array("size"=>"4","maxlength"=>"8")); ?> 217 </p> 218 <p> 219 <label for="scurrency_accuracy">currency decimal points of accuracy</label><br /> 220 <?php field_text("scurrency_accuracy",$_SESSION["currency_accuracy"],1,"Currency accuracy name cannot be blank and must be a valid integer.","integer",Array("size"=>"4","maxlength"=>"1")); ?> 221 </p> 222 <p> 223 <label for="sdecimal_symbol">decimal symbol</label><br /> 224 <?php field_text("sdecimal_symbol",$_SESSION["decimal_symbol"],1,"Decimal symbol name cannot be blank.","",Array("size"=>"4","maxlength"=>"1")); ?> 225 </p> 226 <p> 227 <label for="sthousands_separator">thousands separator</label><br /> 228 <?php field_text("sthousands_separator",$_SESSION["thousands_separator"],1,"Thousands separator name cannot be blank.","",Array("size"=>"4","maxlength"=>"1")); ?> 229 </p> 214 230 </fieldset> 215 231 <?php trunk/phpbms/modules/base/include/notes_addedit_include.php
r191 r192 207 207 if(isset($variables["completed"])) { 208 208 $querystatement.="completed=1, "; 209 $querystatement.="completeddate=\"".sqlDateFromString($variables["completeddate"])." , ";209 $querystatement.="completeddate=\"".sqlDateFromString($variables["completeddate"])."\", "; 210 210 }else { 211 211 $querystatement.="completed=0, completeddate=NULL, "; trunk/phpbms/modules/base/javascript/notes.js
r166 r192 176 176 var endtimefield=getObjectFromID("endtime"); 177 177 var starttimefield=getObjectFromID("starttime"); 178 var thestart= dateFromField(startdatefield.value,starttimefield.value);179 var theend= dateFromField(enddatefield.value,endtimefield.value);178 var thestart=stringToDatetime(startdatefield.value,starttimefield.value); 179 var theend=stringToDatetime(enddatefield.value,endtimefield.value); 180 180 if (thestart>theend){ 181 181 theend=thestart; 182 182 theend.setHours(theend.getHours()+1); 183 enddatefield.value= englishDate(theend);183 enddatefield.value=dateToString(theend); 184 184 if(starttimefield.value) 185 endtimefield.value= englishTime(theend);185 endtimefield.value=timeToString(theend); 186 186 } 187 187 } … … 219 219 if(type=="end") 220 220 today.setHours(today.getHours()+1); 221 thedate.value= englishDate(today);222 thetime.value= englishTime(today);221 thedate.value= dateToString(today); 222 thetime.value= timeToString(today); 223 223 } 224 224 thetext.className=null; … … 370 370 var startdate= getObjectFromID("startdate"); 371 371 if(startdate.value=="") return false; 372 var thedate= dateFromField(startdate.value)372 var thedate= stringToDatetime(startdate.value) 373 373 var theday= parseInt(startdate.value.substring(startdate.value.indexOf("/")+1,startdate.value.lastIndexOf("/")),10); 374 374 trunk/phpbms/modules/bms/discounts_addedit.php
r176 r192 79 79 <p> 80 80 <strong>Orders</strong> (<?php echo $stats["Order"]["total"]?>)<br/> 81 total: <?php echo currencyFormat($stats["Order"]["sum"])?>81 total: <?php echo numberToCurrency($stats["Order"]["sum"])?> 82 82 </p> 83 83 <p> 84 84 <strong>Invoices</strong> (<?php echo $stats["Invoice"]["total"]?>)<br /> 85 total: <?php echo currencyFormat($stats["Invoice"]["sum"])?>85 total: <?php echo numberToCurrency($stats["Invoice"]["sum"])?> 86 86 </p> 87 87 </fieldset> … … 109 109 <p id="aValue"> 110 110 <label for="amountvalue">value</label><br /> 111 <?php field_ dollar("amountvalue",$therecord["value"],1,"Value is required",Array("size"=>"10","maxlength"=>"10"))?>111 <?php field_currency("amountvalue",$therecord["value"],1,"Value is required",Array("size"=>"10","maxlength"=>"10"))?> 112 112 </p> 113 113 </fieldset> trunk/phpbms/modules/bms/include/discounts_addedit_include.php
r170 r192 123 123 $variables["percentvalue"]="0"; 124 124 $querystatement.="value=".$variables["percentvalue"].", "; 125 } else { 126 $amountvalue=ereg_replace("\\\$|,","",$variables["amountvalue"]); 127 $querystatement.="value=".$amountvalue.", "; 128 } 125 } else 126 $querystatement.="value=".currencyToNumber($variables["amountvalue"]).", "; 129 127 130 128 //==== Almost all records should have this ========= … … 158 156 $variables["percentvalue"]="0"; 159 157 $querystatement.=$variables["percentvalue"].", "; 160 } else { 161 $amountvalue=ereg_replace("\\\$|,","",$variables["amountvalue"]); 162 $querystatement.=$amountvalue.", "; 163 } 158 } else 159 $querystatement.=currencyToNumber($variables["amountvalue"]).", "; 164 160 165 161 //==== Almost all records should have this ========= trunk/phpbms/modules/bms/include/invoices_addedit_include.php
r191 r192 146 146 while($therecord=mysql_fetch_array($queryresult)){ 147 147 if($therecord["type"]=="amount") 148 $therecord["value"]= currencyFormat($therecord["value"]);148 $therecord["value"]=numberToCurrency($therecord["value"]); 149 149 else 150 150 $therecord["value"].="%"; … … 168 168 $therecord["name"].=": ".$therecord["value"]; 169 169 } else 170 $therecord["name"].=": ". currencyFormat($therecord["value"]);170 $therecord["name"].=": ".numberToCurrency($therecord["value"]); 171 171 } 172 172 $therecord["name"]=htmlspecialchars($therecord["name"]); … … 447 447 $querystatement.="orderdate=".$tempdate.", "; 448 448 449 $discountamount=ereg_replace("\\\$|,","",$variables["discountamount"]); 450 $querystatement.="discountamount=".$discountamount.", "; 449 $querystatement.="discountamount=".currencyToNumber($variables["discountamount"]).", "; 451 450 if($variables["discountid"]=="")$variables["discountid"]="NULL"; 452 451 $querystatement.="discountid=".$variables["discountid"].", "; … … 467 466 $querystatement.="country=\"".$variables["country"]."\", "; 468 467 469 $totaltni=ereg_replace("\\\$|,","",$variables["totaltni"]); 470 $totaltaxable=ereg_replace("\\\$|,","",$variables["totaltaxable"]); 471 $totalti=ereg_replace("\\\$|,","",$variables["totalti"]); 472 $shipping=ereg_replace("\\\$|,","",$variables["shipping"]); 473 $tax=ereg_replace("\\\$|,","",$variables["tax"]); 474 $amountpaid=ereg_replace("\\\$|,","",$variables["amountpaid"]); 475 476 $querystatement.="totaltni=".$totaltni.", "; 477 $querystatement.="totaltaxable=".$totaltaxable.", "; 478 $querystatement.="totalti=".$totalti.", "; 479 $querystatement.="shipping=".$shipping.", "; 480 $querystatement.="tax=".$tax.", "; 481 $querystatement.="amountpaid=".$amountpaid.", "; 468 $querystatement.="totaltni=".currencyToNumber($variables["totaltni"]).", "; 469 $querystatement.="totaltaxable=".currencyToNumber($variables["totaltaxable"]).", "; 470 $querystatement.="totalti=".currencyToNumber($variables["totalti"]).", "; 471 $querystatement.="shipping=".currencyToNumber($variables["shipping"]).", "; 472 $querystatement.="tax=".currencyToNumber($variables["tax"]).", "; 473 $querystatement.="amountpaid=".currencyToNumber($variables["amountpaid"]).", "; 482 474 483 475 $querystatement.="totalcost=".$variables["totalcost"].", "; … … 565 557 $querystatement.=((int)$variables["statusid"]).", "; 566 558 $querystatement.=((int) $variables["assignedtoid"]).", "; 567 if($variables["statusdate"]=="" || $variables["statusdate"]=="0/0/0000") $tempdate="NULL";559 if($variables["statusdate"]=="") $tempdate="NULL"; 568 560 else 569 561 $tempdate="\"".sqlDateFromString($variables["statusdate"])."\""; 570 562 $querystatement.=$tempdate.", "; 571 563 572 if($variables["orderdate"]=="" || $variables["orderdate"]=="0/0/0000") $tempdate="NULL";564 if($variables["orderdate"]=="") $tempdate="NULL"; 573 565 else 574 566 $tempdate="\"".sqlDateFromString($variables["orderdate"])."\""; 575 567 $querystatement.=$tempdate.", "; 576 568 577 $discountamount=ereg_replace("\\\$|,","",$variables["discountamount"]); 578 $querystatement.=$discountamount.", "; 569 $querystatement.=currencyToNumber($variables["discountamount"]).", "; 579 570 if($variables["discountid"]=="")$variables["discountid"]="NULL"; 580 571 $querystatement.=$variables["discountid"].", "; 581 572 582 if($variables["invoicedate"]=="" || $variables["invoicedate"]=="0/0/0000") $tempdate="NULL";573 if($variables["invoicedate"]=="") $tempdate="NULL"; 583 574 else 584 575 $tempdate="\"".sqlDateFromString($variables["invoicedate"])."\""; … … 595 586 $querystatement.="\"".$variables["country"]."\", "; 596 587 597 $totaltni=ereg_replace("\\\$|,","",$variables["totaltni"]); 598 $totaltaxable=ereg_replace("\\\$|,","",$variables["totaltaxable"]); 599 $totalti=ereg_replace("\\\$|,","",$variables["totalti"]); 600 $shipping=ereg_replace("\\\$|,","",$variables["shipping"]); 601 $tax=ereg_replace("\\\$|,","",$variables["tax"]); 602 $amountpaid=ereg_replace("\\\$|,","",$variables["amountpaid"]); 603 604 $querystatement.=$totaltni.", "; 605 $querystatement.=$totaltaxable.", "; 606 $querystatement.=$totalti.", "; 607 $querystatement.=$shipping.", "; 608 $querystatement.=$tax.", "; 609 $querystatement.=$amountpaid.", "; 588 $querystatement.=currencyToNumber($variables["totaltni"]).", "; 589 $querystatement.=currencyToNumber($variables["totaltaxable"]).", "; 590 $querystatement.=currencyToNumber($variables["totalti"]).", "; 591 $querystatement.=currencyToNumber($variables["shipping"]).", "; 592 $querystatement.=currencyToNumber($variables["tax"]).", "; 593 $querystatement.=currencyToNumber($variables["amountpaid"]).", "; 610 594 611 595 $querystatement.=$variables["totalcost"].", "; trunk/phpbms/modules/bms/include/products_addedit_include.php
r189 r192 142 142 if(isset($variables["inactive"])) $querystatement.="inactive=1, "; else $querystatement.="inactive=0, "; 143 143 if(isset($variables["taxable"])) $querystatement.="taxable=1, "; else $querystatement.="taxable=0, "; 144 145 $unitprice=ereg_replace("\\\$|,","",$variables["unitprice"]); 146 $unitcost=ereg_replace("\\\$|,","",$variables["unitcost"]); 147 148 $querystatement.="unitprice=".$unitprice.", "; 149 $querystatement.="unitcost=".$unitcost.", "; 144 145 $querystatement.="unitprice=".currencyToNumber($variables["unitprice"]).", "; 146 $querystatement.="unitcost=".currencyToNumber($variables["unitcost"]).", "; 150 147 $querystatement.="unitofmeasure=\"".$variables["unitofmeasure"]."\", "; 151 148 … … 239 236 if(isset($variables["taxable"])) $querystatement.="1, "; else $querystatement.="0, "; 240 237 $querystatement.="\"".$variables["memo"]."\", "; 241 242 $unitprice=ereg_replace("\\\$|,","",$variables["unitprice"]); 243 $unitcost=ereg_replace("\\\$|,","",$variables["unitcost"]); 244 245 $querystatement.=$unitprice.", "; 246 $querystatement.=$unitcost.", "; 238 239 $querystatement.=currencyToNumber($variables["unitprice"]).", "; 240 $querystatement.=currencyToNumber($variables["unitcost"]).", "; 247 241 $querystatement.="\"".$variables["unitofmeasure"]."\", "; 248 242 trunk/phpbms/modules/bms/invoices_addedit.php
r184 r192 234 234 </td> 235 235 <td width="100%"><input name="memo" type="text" id="memo" size="12" maxlength="255" tabindex="17" /></td> 236 <td align="right" nowrap><input name="price" type="text" id="price" value="<?php echo currencyFormat(0)?>" size="10" maxlength="16" onchange="calculateExtended()" class="fieldCurrency" tabindex="18" /></td>236 <td align="right" nowrap><input name="price" type="text" id="price" value="<?php echo numberToCurrency(0)?>" size="10" maxlength="16" onchange="calculateExtended()" class="fieldCurrency" tabindex="18" /></td> 237 237 <td align="center" nowrap><input name="qty" type="text" id="qty" value="1" size="5" maxlength="16" onchange="calculateExtended()" tabindex="19" /></td> 238 <td align="right" nowrap><input name="extended" type="text" i