www.pudn.com > sale.rar > cims.js
// Alter messages
function message(msg) {
if (msg == "") return false;
var mez = false;
switch (msg) {
// ClientCheck
case 'LOGIN_ERR_INPUT_DATA': mez = '请输入必要的信息或正确长度的信息'; break;
case 'DATE_ERR_INPUT_DATE': mez = '请输入正确的日期'; break;
case 'PRM_OS011_ERR_NO_CHECK_CONFIRM': mez = '请选择要删除的记录'; break;
case 'PRICE_ERR_INPUT_PRICE': mez = '请输入正确的价格'; break;
case 'CROPSIZE_ERR_INPUT_CROPSIZE': mez = '请输入正确的企业人数'; break;
case 'YEARTAKING_ERR_INPUT_YEARTAKING': mez = '请输入正确的企业年收入'; break;
case 'ASSET_ERR_INPUT_ASSET': mez = '请输入正确的企业资产'; break;
case 'SYSANALYSE_ERR_SELECT_DATE': mez = '请输入正确的日期.'; break;
case "ERR_INPUT_DATE" :mez="请输入正确的日期"; break;
case "ERR_INPUT_AUTOID" :mez="请输入车辆识别编号"; break;
case "ERR_INPUT_PAGE" :mez="请输入正确的页数,正确的页数为:1-"; break;
case "ERR_INPUT_QUALITYREASON" :mez="请输入质量问题"; break;
case "ERR_NO_SELECTED_RECORD" :mez="请选择要删除的记录"; break;
case "SURE_DELETE" :mez="确信要删除选定的记录吗"; break;
case "ERR_NOT_INPUT_USERID" :mez="请输入用户名"; break;
case "ERR_NOT_INPUT_PASSWORD" :mez="请输入密码"; break;
case "ERR_INPUT_PASSWORD" :mez="用户名或密码不正确"; break;
case "ERR_INPUT_CUSTOMER":mez="请输入正确的客户编码";break;
//end adding by wbb on 2003/06/23
default: mez = '未知的错误'; break;
}
return mez;
}
//*******Check input data and submit ------------------------------***************8
function searchsale(fny,fnm,fnd,tny,tnm,tnd){
var pass="Yes";
var fullFrom=0;
var fullTo=0;
var sale="no";
if (tnd.value.length!=0 &&
(isNaN(tnd.value) ||
tnd.value<1 ||
tnd.value>31)){
tnd.style.cssText += (';' + "background-color:red;");
tnd.focus();
pass="No";
} else {
tnd.style.cssText += (';' + "background-color:white;");
}
//To Mooth
if (tnm.value.length!=0 &&
(isNaN(tnm.value) ||
tnm.value<1 ||
tnm.value>12)) {
tnm.style.cssText += (';' + "background-color:red;");
tnm.focus();
pass="No";
} else {
tnm.style.cssText += (';' + "background-color:white;");
}
//To Year
if (tny.value.length!=0 &&
(tny.value.length!=4 ||
isNaN(tny.value) ||
tny.value<1 )) {
tny.style.cssText += (';' + "background-color:red;");
tny.focus();
pass="No";
} else {
tny.style.cssText += (';' + "background-color:white;");
}
//From Day
if (fnd.value.length!=0 &&
(isNaN(fnd.value) ||
fnd.value<1 ||
fnd.value>31)) {
fnd.style.cssText += (';' + "background-color:red;");
fnd.focus();
pass="No";
} else {
fnd.style.cssText += (';' + "background-color:white;");
}
//From Mooth
if (fnm.value.length!=0 &&
(isNaN(fnm.value) ||
fnm.value<1 ||
fnm.value>12 )) {
fnm.style.cssText += (';' + "background-color:red;");
fnm.focus();
pass="No";
} else {
fnm.style.cssText += (';' + "background-color:white;");
}
//From Year
if (fny.value.length!=0 &&
(fny.value.length!=4 ||
isNaN(fny.value) ||
fny.value<1 )) {
fny.style.cssText += (';' + "background-color:red;");
fny.focus();
pass="No";
} else {
fny.style.cssText += (';' + "background-color:white;");
}
//To date is full
if (tny.value.length!=0){
fullTo += 1;
}
if (tnm.value.length!=0){
fullTo += 2;
}
if (tnd.value.length!=0){
fullTo += 4;
}
if (fullTo == 1 ){
tnm.style.cssText += (';' + "background-color:red;");
tnd.style.cssText += (';' + "background-color:red;");
tnm.focus();
pass="No";
} else if (fullTo == 2 ){
tny.style.cssText += (';' + "background-color:red;");
tnd.style.cssText += (';' + "background-color:red;");
tny.focus();
pass="No";
} else if (fullTo == 3 ){
tnd.style.cssText += (';' + "background-color:red;");
tnd.focus();
pass="No";
} else if (fullTo == 4 ){
tny.style.cssText += (';' + "background-color:red;");
tnm.style.cssText += (';' + "background-color:red;");
tny.focus();
pass="No";
} else if (fullTo == 5 ){
tnm.style.cssText += (';' + "background-color:red;");
tnm.focus();
pass="No";
} else if (fullTo == 6 ){
tnd.style.cssText += (';' + "background-color:red;");
tnd.focus();
pass="No";
} else if (fullTo == 7 ){
//To date is a date
if (!isDate(
Number(tny.value),
Number(tnm.value),
Number(tnd.value))) {
tnd.style.cssText += (';' + "background-color:red;");
tnd.focus();
pass="No";
} else {
tnd.style.cssText += (';' + "background-color:white;");
}
}
//From date is full
if (fny.value.length!=0){
fullFrom += 1;
}
if (fnm.value.length!=0){
fullFrom += 2;
}
if (fnd.value.length!=0){
fullFrom += 4;
}
if (fullFrom == 1 ){
fnm.style.cssText += (';' + "background-color:red;");
fnd.style.cssText += (';' + "background-color:red;");
fnm.focus();
pass="No";
} else if (fullFrom == 2 ){
fny.style.cssText += (';' + "background-color:red;");
fnd.style.cssText += (';' + "background-color:red;");
fny.focus();
pass="No";
} else if (fullFrom == 3 ){
fnd.style.cssText += (';' + "background-color:red;");
fnd.focus();
pass="No";
} else if (fullFrom == 4 ){
fny.style.cssText += (';' + "background-color:red;");
fnm.style.cssText += (';' + "background-color:red;");
fny.focus();
pass="No";
} else if (fullFrom == 5 ){
fnm.style.cssText += (';' + "background-color:red;");
fnm.focus();
pass="No";
} else if (fullFrom == 6 ){
fnd.style.cssText += (';' + "background-color:red;");
pass="No";
fnd.focus();
} else if (fullFrom == 7 ){
//From date is a date
if (!isDate(
Number(fny.value),
Number(fnm.value),
Number(fnd.value))) {
fnd.style.cssText += (';' + "background-color:red;");
fnd.focus();
pass="No";
} else {
fnd.style.cssText += (';' + "background-color:white;");
}
}
//FromDate < ToDate
if (pass=="Yes" && fullFrom == 7 && fullTo == 7) {
if (!isFromTo(
Number(fny.value),
Number(fnm.value),
Number(fnd.value),
Number(tny.value),
Number(tnm.value),
Number(tnd.value))) {
fny.style.cssText += (';' + "background-color:red;");
fnm.style.cssText += (';' + "background-color:red;");
fnd.style.cssText += (';' + "background-color:red;");
tny.style.cssText += (';' + "background-color:red;");
tnm.style.cssText += (';' + "background-color:red;");
tnd.style.cssText += (';' + "background-color:red;");
fny.focus();
pass="No";
} else {
fny.style.cssText += (';' + "background-color:white;");
fnm.style.cssText += (';' + "background-color:white;");
fnd.style.cssText += (';' + "background-color:white;");
tny.style.cssText += (';' + "background-color:white;");
tnm.style.cssText += (';' + "background-color:white;");
tnd.style.cssText += (';' + "background-color:white;");
}
}
if (pass=="No") {
alert(message("DATE_ERR_INPUT_DATE"));
}
return pass;
}
function searchex(tny,tnm,tnd){
var pass="Yes";
var passe="Yes";
var fullFrom=0;
var fullTo=0;
var exsale="no";
var fullFromd=0;
var fullToe=0;
//To Day
if (tnd.value.length!=0 &&
(isNaN(tnd.value) ||
tnd.value<1 ||
tnd.value>31)){
tnd.style.cssText += (';' + "background-color:red;");
tnd.focus();
pass="No";
} else{
tnd.style.cssText += (';' + "background-color:white;");
}
//To Mooth
if (tnm.value.length!=0 &&
(isNaN(tnm.value) ||
tnm.value<1 ||
tnm.value>12)) {
tnm.style.cssText += (';' + "background-color:red;");
tnm.focus();
pass="No";
} else {
tnm.style.cssText += (';' + "background-color:white;");
}
//To Year
if (tny.value.length!=0 &&
(tny.value.length!=4 ||
isNaN(tny.value) ||
tny.value<1)){
tny.style.cssText += (';' + "background-color:red;");
tny.focus();
pass="No";
} else {
tny.style.cssText += (';' + "background-color:white;");
}
//To date is full
if (tny.value.length!=0){
fullTo += 1;
}
if (tnm.value.length!=0){
fullTo += 2;
}
if (tnd.value.length!=0){
fullTo += 4;
}
if (fullTo == 1 ){
tnm.style.cssText += (';' + "background-color:red;");
tnd.style.cssText += (';' + "background-color:red;");
tnm.focus();
pass="No";
} else if (fullTo == 2 ){
tny.style.cssText += (';' + "background-color:red;");
tnd.style.cssText += (';' + "background-color:red;");
tny.focus();
pass="No";
} else if (fullTo == 3 ){
tnd.style.cssText += (';' + "background-color:red;");
tnd.focus();
pass="No";
} else if (fullTo == 4 ){
tny.style.cssText += (';' + "background-color:red;");
tnm.style.cssText += (';' + "background-color:red;");
tny.focus();
pass="No";
} else if (fullTo == 5 ){
tnm.style.cssText += (';' + "background-color:red;");
tnm.focus();
pass="No";
} else if (fullTo == 6 ){
tnd.style.cssText += (';' + "background-color:red;");
tnd.focus();
pass="No";
} else if (fullTo == 7 ){
//To date is a date
if (!isDate(
Number(tny.value),
Number(tnm.value),
Number(tnd.value))) {
tnd.style.cssText += (';' + "background-color:red;");
tnd.focus();
pass="No";
} else {
tnd.style.cssText += (';' + "background-color:white;");
}
}
if(pass=="No") {
alert(message("DATE_ERR_INPUT_DATE"));
}
return pass;
}
function getYear(d) {
return (d < 1000) ? d + 1900 : d;
}
function isDate (year, month, day) {
// month argument must be in the range 1 - 12
month = month - 1; // javascript month range : 0- 11
var tempDate = new Date(year,month,day);
if ( (getYear(tempDate.getYear()) == year) &&
(month == tempDate.getMonth()) &&
(day == tempDate.getDate()) )
return true;
else
return false;
}
//formDate <= toDate
function isFromTo(year1, month1, day1, year2, month2, day2) {
// month argument must be in the range 1 - 12
month1 = month1 - 1; // javascript month range : 0- 11
month2 = month2 - 1; // javascript month range : 0- 11
var Date1 = new Date(year1, month1, day1);
var Date2 = new Date(year2, month2, day2);
if (Date.parse(Date1) <= Date.parse(Date2)){
return true;
} else {
return false;
}
}
function checkSYSdate(formname){
var pass = "Y";
if(formname.fy.value.length != 0 ||
formname.fm.value.length != 0 ||
formname.fd.value.length != 0){
if(!isDate(Number(formname.fy.value),
Number(formname.fm.value),
Number(formname.fd.value))){
formname.ty.style.cssText += (';' + "background-color:white;");
formname.tm.style.cssText += (';' + "background-color:white;");
formname.td.style.cssText += (';' + "background-color:white;");
formname.fy.style.cssText += (';' + "background-color:red;");
formname.fm.style.cssText += (';' + "background-color:red;");
formname.fd.style.cssText += (';' + "background-color:red;");
pass = "N";
alert(message("SYSANALYSE_ERR_SELECT_DATE"));
}
}else if(formname.ty.value.length != 0 ||
formname.tm.value.length != 0 ||
formname.td.value.length != 0){
if(!isDate(Number(formname.ty.value),
Number(formname.tm.value),
Number(formname.td.value))){
formname.fy.style.cssText += (';' + "background-color:white;");
formname.fm.style.cssText += (';' + "background-color:white;");
formname.fd.style.cssText += (';' + "background-color:white;");
formname.ty.style.cssText += (';' + "background-color:red;");
formname.tm.style.cssText += (';' + "background-color:red;");
formname.td.style.cssText += (';' + "background-color:red;");
pass = "N";
alert(message("SYSANALYSE_ERR_SELECT_DATE"));
}
}else{
formname.fy.style.cssText += (';' + "background-color:white;");
formname.fm.style.cssText += (';' + "background-color:white;");
formname.fd.style.cssText += (';' + "background-color:white;");
formname.ty.style.cssText += (';' + "background-color:white;");
formname.tm.style.cssText += (';' + "background-color:white;");
formname.td.style.cssText += (';' + "background-color:white;");
pass = "Y";
}
return pass;
}
function compDate(formname)
{
var pass = "Y";
if(formname.fy.value.length != 0 && formname.fm.value.length != 0 && formname.fd.value.length != 0 &&
formname.ty.value.length != 0 && formname.tm.value.length != 0 && formname.td.value.length != 0){
if(isDate(Number(formname.fy.value),Number(formname.fm.value),Number(formname.fd.value)) &&
isDate(Number(formname.ty.value),Number(formname.tm.value),Number(formname.td.value))){
if (!isFromTo(
Number(formname.fy.value),
Number(formname.fm.value),
Number(formname.fd.value),
Number(formname.ty.value),
Number(formname.tm.value),
Number(formname.td.value))) {
formname.fy.style.cssText += (';' + "background-color:red;");
formname.fm.style.cssText += (';' + "background-color:red;");
formname.fd.style.cssText += (';' + "background-color:red;");
formname.ty.style.cssText += (';' + "background-color:red;");
formname.tm.style.cssText += (';' + "background-color:red;");
formname.td.style.cssText += (';' + "background-color:red;");
pass = "N";
alert(message("SYSANALYSE_ERR_SELECT_DATE"));
}else{
formname.fy.style.cssText += (';' + "background-color:white;");
formname.fm.style.cssText += (';' + "background-color:white;");
formname.fd.style.cssText += (';' + "background-color:white;");
formname.ty.style.cssText += (';' + "background-color:white;");
formname.tm.style.cssText += (';' + "background-color:white;");
formname.td.style.cssText += (';' + "background-color:white;");
pass = "Y";
}
}else{
formname.fy.style.cssText += (';' + "background-color:red;");
formname.fm.style.cssText += (';' + "background-color:red;");
formname.fd.style.cssText += (';' + "background-color:red;");
formname.ty.style.cssText += (';' + "background-color:red;");
formname.tm.style.cssText += (';' + "background-color:red;");
formname.td.style.cssText += (';' + "background-color:red;");
pass = "N";
alert(message("SYSANALYSE_ERR_SELECT_DATE"));
}
}
return pass;
}
function delOptions(objDst,boolSet){
var len = objDst.length-1;
if (boolSet==true){
for(i=len;i>=0;i--){
objDst.remove(i);
}
}
else{
for(i=len;i>0;i--){
objDst.remove(i);
}
}
}
//选择objsrc中的某一项时,在objdst中追加选项
function addOption(objsrc,objdst,boolSet){
delOptions(objdst,boolSet);
var objForm=objdst.form;
var dst;
//objsrc是一个对象时
if (objsrc.value!=null){
dst=objForm.all.item(objsrc.value);
}
//objsrc是一个字符串时
else {
dst=objForm.all.item(objsrc);
}
//返回元素不存在时
if (dst==null) return;
//返回一个数组元素
if (dst.length!=null){
for (var i=0;i31)){
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnd.focus();
pass="No";
} else {
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:white;");
}
//To Mooth
if (document.Prm_OS011.tnm.value.length!=0 &&
(isNaN(document.Prm_OS011.tnm.value) ||
document.Prm_OS011.tnm.value<1 ||
document.Prm_OS011.tnm.value>12)) {
document.Prm_OS011.tnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnm.focus();
pass="No";
} else {
document.Prm_OS011.tnm.style.cssText += (';' + "background-color:white;");
}
//To Year
if (document.Prm_OS011.tny.value.length!=0 &&
(document.Prm_OS011.tny.value.length!=4 ||
isNaN(document.Prm_OS011.tny.value) ||
document.Prm_OS011.tny.value<1 )) {
document.Prm_OS011.tny.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tny.focus();
pass="No";
} else {
document.Prm_OS011.tny.style.cssText += (';' + "background-color:white;");
}
//From Day
if (document.Prm_OS011.fnd.value.length!=0 &&
(isNaN(document.Prm_OS011.fnd.value) ||
document.Prm_OS011.fnd.value<1 ||
document.Prm_OS011.fnd.value>31)) {
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnd.focus();
pass="No";
} else {
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:white;");
}
//From Mooth
if (document.Prm_OS011.fnm.value.length!=0 &&
(isNaN(document.Prm_OS011.fnm.value) ||
document.Prm_OS011.fnm.value<1 ||
document.Prm_OS011.fnm.value>12 )) {
document.Prm_OS011.fnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnm.focus();
pass="No";
} else {
document.Prm_OS011.fnm.style.cssText += (';' + "background-color:white;");
}
//From Year
if (document.Prm_OS011.fny.value.length!=0 &&
(document.Prm_OS011.fny.value.length!=4 ||
isNaN(document.Prm_OS011.fny.value) ||
document.Prm_OS011.fny.value<1 )) {
document.Prm_OS011.fny.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fny.focus();
pass="No";
} else {
document.Prm_OS011.fny.style.cssText += (';' + "background-color:white;");
}
//To date is full
if (document.Prm_OS011.tny.value.length!=0){
fullTo += 1;
}
if (document.Prm_OS011.tnm.value.length!=0){
fullTo += 2;
}
if (document.Prm_OS011.tnd.value.length!=0){
fullTo += 4;
}
if (fullTo == 1 ){
document.Prm_OS011.tnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnm.focus();
pass="No";
} else if (fullTo == 2 ){
document.Prm_OS011.tny.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tny.focus();
pass="No";
} else if (fullTo == 3 ){
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnd.focus();
pass="No";
} else if (fullTo == 4 ){
document.Prm_OS011.tny.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tny.focus();
pass="No";
} else if (fullTo == 5 ){
document.Prm_OS011.tnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnm.focus();
pass="No";
} else if (fullTo == 6 ){
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnd.focus();
pass="No";
} else if (fullTo == 7 ){
//To date is a date
if (!isDate(
Number(document.Prm_OS011.tny.value),
Number(document.Prm_OS011.tnm.value),
Number(document.Prm_OS011.tnd.value))) {
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnd.focus();
pass="No";
} else {
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:white;");
}
}
//From date is full
if (document.Prm_OS011.fny.value.length!=0){
fullFrom += 1;
}
if (document.Prm_OS011.fnm.value.length!=0){
fullFrom += 2;
}
if (document.Prm_OS011.fnd.value.length!=0){
fullFrom += 4;
}
if (fullFrom == 1 ){
document.Prm_OS011.fnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnm.focus();
pass="No";
} else if (fullFrom == 2 ){
document.Prm_OS011.fny.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fny.focus();
pass="No";
} else if (fullFrom == 3 ){
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnd.focus();
pass="No";
} else if (fullFrom == 4 ){
document.Prm_OS011.fny.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fny.focus();
pass="No";
} else if (fullFrom == 5 ){
document.Prm_OS011.fnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnm.focus();
pass="No";
} else if (fullFrom == 6 ){
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnd.focus();
pass="No";
} else if (fullFrom == 7 ){
//From date is a date
if (!isDate(
Number(document.Prm_OS011.fny.value),
Number(document.Prm_OS011.fnm.value),
Number(document.Prm_OS011.fnd.value))) {
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnd.focus();
pass="No";
} else {
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:white;");
}
}
//FromDate < ToDate
if (pass=="Yes" && fullFrom == 7 && fullTo == 7) {
if (!isFromTo(
Number(document.Prm_OS011.fny.value),
Number(document.Prm_OS011.fnm.value),
Number(document.Prm_OS011.fnd.value),
Number(document.Prm_OS011.tny.value),
Number(document.Prm_OS011.tnm.value),
Number(document.Prm_OS011.tnd.value))) {
document.Prm_OS011.fny.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tny.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnm.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:red;");
document.Prm_OS011.fny.focus();
pass="No";
} else {
document.Prm_OS011.fny.style.cssText += (';' + "background-color:white;");
document.Prm_OS011.fnm.style.cssText += (';' + "background-color:white;");
document.Prm_OS011.fnd.style.cssText += (';' + "background-color:white;");
document.Prm_OS011.tny.style.cssText += (';' + "background-color:white;");
document.Prm_OS011.tnm.style.cssText += (';' + "background-color:white;");
document.Prm_OS011.tnd.style.cssText += (';' + "background-color:white;");
}
}
//Pass or not
if (pass=="Yes") {
document.Prm_OS011.submit();
} else {
alert(message("PRM_OS010_ERR_INPUT_DATE"));
}
}
function getStrLen(str){
var len=0;
for (var i=0;i255) len+=2; else len++;
}
return len;
}