📄 smhdl.cpp
字号:
throw Exception("您没有审核/反审核权限");
}
m_SohCheck=value;
}
}
}
void __fastcall TsdSoh::SetSohChecker(AnsiString value)
{
if(m_SohCheck==1)
{
if(value.IsEmpty())
throw Exception("审核人不能为空");
if(value.Length()>18)
throw Exception("审核人代码长度不能大于18");
if(value!=m_SohChecker)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select salercode from sdsaler where salercode='"+value+"' and salercheck=1");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("您无审核权限");
}
m_Query->Close();
}
m_SohChecker=value;
}
else
m_SohChecker="";
}
void __fastcall TsdSoh::SetSohCheckDate(AnsiString value)
{
if(m_SohCheck==1)
{
if(value.IsEmpty())
throw Exception("审核日期不能为空");
m_SohCheckDate=Validate(value);
}
else
m_SohCheckDate="";
}
void __fastcall TsdSoh::SetSohClose(int value)
{
if(b_SohClose!=value)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("Select SalerCode,SalerCheck,SalerClose from sdSaler where SalerCode='"+g_sdUserCode+"'");
m_Query->Open();
if(m_Query->RecordCount<1)
{
m_Query->Close();
throw Exception("您没在销售员表中定义!");
}
else
{
if(m_Query->FieldValues["SalerClose"]==0)
{
m_Query->Close();
throw Exception("您没有结清/反结清权限");
}
m_SohClose=value;
}
}
}
//---------------------------------------------------------------------------
AnsiString TsdSoh::GetFieldValue(euSoh sdFieldName)
{
switch(sdFieldName)
{
case fiSohCode:
return SohCode;
case fiSohType:
return SohType;
case fiSohDate:
return SohDate;
case fiSohClient:
return SohClient;
case fiSohSaler:
return SohSaler;
case fiSohContract:
return SohContract;
case fiSohCurrency:
return SohCurrency;
case fiSohEnrate:
return AnsiString(SohEnrate);
case fiSohTaxCode:
return SohTaxCode;
case fiSohSettleMode:
return SohSettleMode;
case fiSohDeliver:
return SohDeliver;
case fiSohSsite:
return SohSsite;
case fiSohTransMode:
return SohTransMode;
case fiSohPayTrans:
return AnsiString(SohPayTrans);
case fiSohDj:
return FormatFloat("0.00",SohDj);
case fiSohCancel:
return AnsiString(SohCancel);
case fiSohCrCode:
return SohCrCode;
case fiSohCancelDate:
return SohCancelDate;
case fiSohCheck:
return AnsiString(SohCheck);
case fiSohChecker:
return SohChecker;
case fiSohCheckDate:
return SohCheckDate;
case fiSohClose:
return AnsiString(SohClose);
case fiSohUser:
return SohUser;
case fiSohDesc:
return SohDesc;
case fiSohSysDate:
return SohSysDate;
default:
throw Exception("当前字段未定义可取值");
}
}
//---------------------------------------------------------------------------
TsdSoh::TsdSoh(TDataComm *DC)
:TsdHead(DC)
{
try{
m_sdSod=NULL;
QueryString=AnsiString(" SELECT * FROM sdSoh");
FilterString="";
OrderString=" SohCode";
EmptyValue(0);
EmptyValue(1);
}
catch(...)
{
throw Exception("初始化出错");
}
}
TsdSoh::TsdSoh()
:TsdHead()
{
try{
m_sdSod=NULL;
QueryString=AnsiString(" SELECT * FROM sdSoh");
FilterString="";
OrderString=" SohCode";
EmptyValue(0);
EmptyValue(1);
}
catch(...)
{
throw Exception("初始化出错");
}
}
//--------------------------------------------------------------------------
void TsdSoh::SetFieldValue(euSoh sdFieldName, AnsiString Value)
{
Value=Trim(Value);
switch(sdFieldName)
{
case fiSohCode:
SohCode=Value;
break;
case fiSohType:
SohType=Value.ToInt();
break;
case fiSohDate:
SohDate=Value;
break;
case fiSohClient:
SohClient=Value;
break;
case fiSohSaler:
SohSaler=Value;
break;
case fiSohContract:
SohContract=Value;
break;
case fiSohCurrency:
SohCurrency=Value;
break;
case fiSohEnrate:
SohEnrate=Value.ToDouble();
break;
case fiSohTaxCode:
SohTaxCode=Value;
break;
case fiSohSettleMode:
SohSettleMode=Value;
break;
case fiSohDeliver:
SohDeliver=Value;
break;
case fiSohSsite:
SohSsite=Value;
break;
case fiSohTransMode:
SohTransMode=Value;
break;
case fiSohPayTrans:
SohPayTrans=Value.ToInt();
break;
case fiSohDj:
SohDj=Value.ToDouble();
break;
case fiSohDesc:
SohDesc=Value;
break;
case fiSohUser:
SohUser=Value;
break;
case fiSohCrCode:
SohCrCode=Value;
break;
case fiSohCheck:
SohCheck=Value.ToInt();
break;
case fiSohChecker:
SohChecker=Value;
break;
case fiSohCheckDate:
SohCheckDate=Value;
break;
case fiSohCancel:
SohCancel=Value.ToInt();
break;
case fiSohCancelDate:
SohCancelDate=Value;
break;
case fiSohClose:
SohClose=Value.ToInt();
break;
default:
throw Exception("当前字段未定义可赋值");
}
}
//---------------------------------------------------------------------------
void TsdSoh::EmptyValue(int Index)
{
switch(Index)
{
case 0:
m_sdSod=NULL;
m_SohCode ="";
m_SohType =0;
m_SohDate ="";
m_SohClient ="";
m_SohSaler ="";
m_SohContract ="";
m_SohCurrency ="";
m_SohEnrate =1.0;
m_SohTaxCode ="";
m_SohSettleMode ="";
m_SohDeliver ="";
m_SohSsite ="";
m_SohTransMode ="";
m_SohPayTrans =0;
m_SohDj =0.0;
m_SohCancel =0;
m_SohCrCode ="";
m_SohCancelDate ="";
m_SohCheck =0;
m_SohChecker ="";
m_SohCheckDate ="";
m_SohUser ="";
m_SohClose =0;
m_SohDesc ="";
m_SohSysDate ="";
break;
case 1:
b_sdSod=NULL;
b_SohCode ="";
b_SohType =0;
b_SohDate ="";
b_SohClient ="";
b_SohSaler ="";
b_SohContract ="";
b_SohCurrency ="";
b_SohEnrate =1.0;
b_SohTaxCode ="";
b_SohSettleMode ="";
b_SohDeliver ="";
b_SohSsite ="";
b_SohTransMode ="";
b_SohPayTrans =0;
b_SohDj =0.0;
b_SohCancel =0;
b_SohCrCode ="";
b_SohCancelDate ="";
b_SohCheck =0;
b_SohChecker ="";
b_SohCheckDate ="";
b_SohUser ="";
b_SohClose =0;
b_SohDesc ="";
b_SohSysDate ="";
}
}
//---------------------------------------------------------------------------
void TsdSoh::BatchLetValue()
{
m_SohCode =m_Query->FieldValues["SohCode"];
m_SohType =m_Query->FieldValues["SohType"];
m_SohDate =m_Query->FieldValues["SohDate"];
m_SohClient =m_Query->FieldValues["SohClient"];
m_SohSaler =m_Query->FieldValues["SohSaler"];
m_SohContract =m_Query->FieldValues["SohContract"];
m_SohCurrency =m_Query->FieldValues["SohCurrency"];
m_SohEnrate =m_Query->FieldValues["SohEnrate"];
m_SohTaxCode =m_Query->FieldValues["SohTaxCode"];
m_SohSettleMode =m_Query->FieldValues["SohSettleMode"];
m_SohDeliver =m_Query->FieldValues["SohDeliver"];
m_SohSsite =m_Query->FieldValues["SohSsite"];
m_SohTransMode =m_Query->FieldValues["SohTransMode"];
m_SohPayTrans =m_Query->FieldValues["SohPayTrans"];
m_SohDj =m_Query->FieldValues["SohDj"];
m_SohCancel =m_Query->FieldValues["SohCancel"];
m_SohCrCode =m_Query->FieldValues["SohCrCode"];
m_SohCancelDate =m_Query->FieldValues["SohCancelDate"];
m_SohCheck =m_Query->FieldValues["SohCheck"];
m_SohChecker =m_Query->FieldValues["SohChecker"];
m_SohCheckDate =m_Query->FieldValues["SohCheckDate"];
m_SohClose =m_Query->FieldValues["SohClose"];
m_SohUser =m_Query->FieldValues["SohUser"];
m_SohDesc =m_Query->FieldValues["SohDesc"];
m_SohSysDate =m_Query->FieldValues["SohSysDate"];
BackupValue();
}
//---------------------------------------------------------------------------
int TsdSoh::Query()
{
AnsiString m_SqlStr;
m_SqlStr=QueryString;
if(FilterString.IsEmpty()==false)
m_SqlStr=m_SqlStr+" where "+FilterString;
if(OrderString.IsEmpty()==false)
m_SqlStr=m_SqlStr+" Order by "+OrderString;
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add(m_SqlStr);
m_Query->Open();
for(int i=0;i<this->Count;i++)
{
this->LocateByIndex(i);
this->AssignValue();
delete m_sdSod;
}
ClearRecord();
if(m_Query->RecordCount>0)
{
m_Query->First();
while(!m_Query->Eof)
{
BatchLetValue();
NewDetail();
m_sdSod->FilterString=" SodCode='"+m_SohCode+"'";
m_sdSod->OrderString=" SodLine";
m_sdSod->Query();
TsdSoh *p=new TsdSoh();
SetActionID(1);
p->Assign(this);
AddRecord((void *)p,p->SohCode);
m_Query->Next();
}
MoveFirst();
}
m_Query->Close();
return Count;
}
//---------------------------------------------------------------------------
void TsdSoh::Assign(TsdSoh *p)
{
this->SetActionID(p->CurStatus);
this->m_sdSod =p->m_sdSod;
this->m_SohCode =p->m_SohCode;
this->m_SohType =p->m_SohType;
this->m_SohDate =p->m_SohDate;
this->m_SohClient =p->m_SohClient;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -