?? cmhdl.cpp
字號(hào):
if(m_Query->RecordCount<1 )
{
m_Query->Close();
throw Exception("收發(fā)類型編碼 "+value+" 未定義");
}
m_Query->Close();
}
m_AdjCohPosType=value;
}
void __fastcall TsdAdjCoh:: SetAdjCohDesc(AnsiString value)
{
if(value.Length()>40)
throw Exception("調(diào)整原因不能超過40");
m_AdjCohDesc=value;
}
void __fastcall TsdAdjCoh:: SetAdjCohKeeper(AnsiString value)
{
if (value.IsEmpty())
throw Exception("倉管員代碼不能為空!");
if(value.Length()>18)
throw Exception("倉管員代碼長(zhǎng)度不能超過18");
if (value!=m_AdjCohKeeper)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select keepercode from sdkeeper ,sduser where keepercode=usercode and keepercode='"+value+"'");
m_Query->Open();
if(m_Query->RecordCount<1 )
{
m_Query->Close();
throw Exception("倉管員代碼'"+value+"'未定義");
}
m_Query->Close();
}
m_AdjCohKeeper=value;
}
void __fastcall TsdAdjCoh:: SetAdjCohUser(AnsiString value)
{
if(value.IsEmpty())
throw Exception("操作員代碼不能為空");
if(value.Length()>18)
throw Exception("操作員代碼長(zhǎng)度不能大于18");
if(value!=m_AdjCohUser)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select usercode from sduser where usercode='"+value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("操作員代碼'"+value+"'未定義");
}
m_Query->Close();
}
m_AdjCohUser=value;
}
void __fastcall TsdAdjCoh:: SetAdjCohCheck(int value)
{
if(value!=0&&value!=1)
throw Exception("審核標(biāo)志只能取值0-未審核 1-審核");
m_AdjCohCheck=value;
}
void __fastcall TsdAdjCoh:: SetAdjCohChecker(AnsiString value)
{
if(m_AdjCohCheck==1)
{
if(value.IsEmpty())
throw Exception("審核員代碼不能為空");
if(value.Length()>18)
throw Exception("審核員代碼長(zhǎng)度不能大于18");
if(value!=m_AdjCohChecker)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select usercode from sduser where usercode='"+value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("審核員代碼未定義或沒有審核權(quán)限");
}
m_Query->Close();
}
m_AdjCohChecker=value;
}
else
m_AdjCohChecker="";
}
void __fastcall TsdAdjCoh:: SetAdjCohCheckDate(AnsiString value)
{
if(m_AdjCohCheck==1)
{
if(value.IsEmpty())
throw Exception("審核日期不能為空");
m_AdjCohCheckDate=Validate(value);
}
else
m_AdjCohCheckDate="";
}
void __fastcall TsdAdjCoh:: SetAdjCohPost(int value)
{
if(value!=0&&value!=1)
throw Exception("記帳標(biāo)志只能取值0-末計(jì)帳 1-計(jì)帳");
m_AdjCohPost=value;
}
void __fastcall TsdAdjCoh:: SetAdjCohPoster(AnsiString value)
{
if(m_AdjCohCheck==1)
{
if(value.IsEmpty())
throw Exception("記帳員代碼不能為空");
if(value.Length()>18)
throw Exception("記帳員代碼長(zhǎng)度不能大于18");
if(value!=m_AdjCohPoster)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select keepercode from sdkeeper where keepercode='"+value+"' and KeeperPost=1");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("記帳員代碼未定義或沒有記帳權(quán)限");
}
m_Query->Close();
}
m_AdjCohPoster=value;
}
else
m_AdjCohPoster="";
}
void __fastcall TsdAdjCoh:: SetAdjCohPostDate(AnsiString value)
{
if(m_AdjCohCheck==1)
{
if(value.IsEmpty())
throw Exception("記帳日期不能為空");
m_AdjCohPostDate=Validate(value);
}
else
m_AdjCohPostDate="";
}
//---------------------------------------------------------------------------
AnsiString TsdAdjCoh::GetFieldValue(euAdjCoh sdFieldName)
{
switch(sdFieldName)
{
case fiAdjCohCode:
return AdjCohCode;
case fiAdjCohDate:
return AdjCohDate;
case fiAdjCohFmonth:
return AdjCohFmonth;
case fiAdjCohPosType:
return AdjCohPosType;
case fiAdjCohDesc:
return AdjCohDesc;
case fiAdjCohKeeper:
return AdjCohKeeper;
case fiAdjCohUser:
return AdjCohUser;
case fiAdjCohCheck:
return AdjCohCheck;
case fiAdjCohChecker:
return AdjCohChecker;
case fiAdjCohCheckDate:
return AdjCohCheckDate;
case fiAdjCohPost:
return AdjCohPost;
case fiAdjCohPoster:
return AdjCohPoster;
case fiAdjCohPostDate:
return AdjCohPostDate;
case fiAdjCohSysDate:
return AdjCohSysDate;
default:
throw Exception("當(dāng)前未定義可取值");
}
}
//---------------------------------------------------------------------------
void TsdAdjCoh::SetFieldValue(euAdjCoh sdFieldName, AnsiString value)
{
switch(sdFieldName)
{
case fiAdjCohCode:
AdjCohCode=value;
break;
case fiAdjCohDate:
AdjCohDate=value;
break;
case fiAdjCohFmonth:
AdjCohFmonth=value;
break;
case fiAdjCohPosType:
AdjCohPosType=value;
break;
case fiAdjCohDesc:
AdjCohDesc=value;
break;
case fiAdjCohKeeper:
AdjCohKeeper=value;
break;
case fiAdjCohUser:
AdjCohUser=value;
break;
case fiAdjCohCheck:
AdjCohCheck=value.ToInt();
break;
case fiAdjCohChecker:
AdjCohChecker=value;
break;
case fiAdjCohCheckDate:
AdjCohCheckDate=value;
break;
case fiAdjCohPost:
AdjCohPost=value.ToInt();
break;
case fiAdjCohPoster:
AdjCohPoster=value;
break;
case fiAdjCohPostDate:
AdjCohPostDate=value;
break;
default:
throw Exception("當(dāng)前字段未定義可賦值");
}
}
//---------------------------------------------------------------------------
TsdAdjCoh::TsdAdjCoh(TDataComm *DC)
:TsdHead(DC)
{
try
{
m_sdAdjCod=NULL;
EmptyValue(0);
EmptyValue(1);
QueryString="SELECT * FROM sdAdjCoh";
FilterString="";
OrderString="AdjCohCode";
}
catch(Exception &e)
{
ShowMessage(e.Message);
}
}
//---------------------------------------------------------------------------
TsdAdjCoh::TsdAdjCoh()
:TsdHead()
{
try
{
m_sdAdjCod=NULL;
EmptyValue(0);
EmptyValue(1);
QueryString="SELECT * FROM sdAdjCoh";
FilterString="";
OrderString="AdjCohCode";
}
catch(Exception &e)
{
ShowMessage(e.Message);
}
}
//---------------------------------------------------------------------------
TsdAdjCoh::~TsdAdjCoh()
{
try{
for(int i=0;i<this->Count;i++)
{
this->LocateByIndex(i);
this->AssignValue();
delete m_sdAdjCod;
}
}
catch(...)
{
throw Exception("析構(gòu)函數(shù)出錯(cuò)");
}
}
//---------------------------------------------------------------------------
void TsdAdjCoh::Update()
{
if(CurStatus==0||CurStatus==1)
throw Exception("當(dāng)前不是編輯狀態(tài),不能進(jìn)行存盤操作!");
if(m_AdjCohCode.IsEmpty()==true)
throw Exception("單號(hào)不能為空!");
if(ItemCount<=0)
throw Exception("單沒有定義明細(xì)字段");
m_StoredProc->Close();
switch(CurStatus)
{
case 2:
case 4:
m_StoredProc->ProcedureName="sdAdjCoh_Insert";
m_StoredProc->Parameters->Clear();
m_StoredProc->Parameters->CreateParameter("@AdjCohCode",ftString,pdInputOutput,18,m_AdjCohCode);
m_StoredProc->Parameters->CreateParameter("@AdjCohDate",ftString,pdInput,10,m_AdjCohDate);
m_StoredProc->Parameters->CreateParameter("@AdjCohFmonth",ftString,pdInput,6,m_AdjCohFmonth);
m_StoredProc->Parameters->CreateParameter("@AdjCohPosType",ftString,pdInput,18,m_AdjCohPosType);
m_StoredProc->Parameters->CreateParameter("@AdjCohDesc",ftString,pdInput,40,m_AdjCohDesc);
m_StoredProc->Parameters->CreateParameter("@AdjCohKeeper",ftString,pdInput,18,m_AdjCohKeeper);
m_StoredProc->Parameters->CreateParameter("@AdjCohUser",ftString,pdInput,18,m_AdjCohUser);
m_StoredProc->Parameters->CreateParameter("@AdjCohCheck",ftInteger,pdInput,1,m_AdjCohCheck);
m_StoredProc->Parameters->CreateParameter("@AdjCohChecker",ftString,pdInput,18,m_AdjCohChecker);
m_StoredProc->Parameters->CreateParameter("@AdjCohCheckDate",ftString,pdInput,10,m_AdjCohCheckDate);
m_StoredProc->Parameters->CreateParameter("@AdjCohPost",ftInteger,pdInput,1,m_AdjCohPost);
m_StoredProc->Parameters->CreateParameter("@AdjCohPoster",ftString,pdInput,18,m_AdjCohPoster);
m_StoredProc->Parameters->CreateParameter("@AdjCohPostDate",ftString,pdInput,10,m_AdjCohPostDate);
m_StoredProc->Parameters->CreateParameter("@AdjCohSysDate",ftString,pdOutput,40,m_AdjCohSysDate);
m_StoredProc->ExecProc();
m_StoredProc->Close();
m_AdjCohSysDate=m_StoredProc->Parameters->ParamValues["@AdjCohSysDate"];
m_AdjCohCode=m_StoredProc->Parameters->ParamValues["@AdjCohCode"];
for(int i=0;i<ItemCount;i++)
{
LocateItemByIndex(i);
m_sdAdjCod->SetFieldValue(fiAdjCodCode,m_AdjCohCode);
AddToObject();
m_sdAdjCod->Update();
}
break;
case 3:
m_StoredProc->ProcedureName="sdAdjCoh_Update";
m_StoredProc->Parameters->Clear();
m_StoredProc->Parameters->CreateParameter("@W_AdjCohCode",ftString,pdInput,18,b_AdjCohCode);
m_StoredProc->Parameters->CreateParameter("@AdjCohCode",ftString,pdInput,18,m_AdjCohCode);
m_StoredProc->Parameters->CreateParameter("@AdjCohDate",ftString,pdInput,10,m_AdjCohDate);
m_StoredProc->Parameters->CreateParameter("@AdjCohFmonth",ftString,pdInput,6,m_AdjCohFmonth);
m_StoredProc->Parameters->CreateParameter("@AdjCohPosType",ftString,pdInput,18,m_AdjCohPosType);
m_StoredProc->Parameters->CreateParameter("@AdjCohDesc",ftString,pdInput,40,m_AdjCohDesc);
m_StoredProc->Parameters->CreateParameter("@AdjCohKeeper",ftString,pdInput,18,m_AdjCohKeeper);
m_StoredProc->Parameters->CreateParameter("@AdjCohUser",ftString,pdInput,18,m_AdjCohUser);
m_StoredProc->Parameters->CreateParameter("@AdjCohCheck",ftInteger,pdInput,1,m_AdjCohCheck);
m_StoredProc->Parameters->CreateParameter("@AdjCohChecker",ftString,pdInput,18,m_AdjCohChecker);
m_StoredProc->Parameters->CreateParameter("@AdjCohCheckDate",ftString,pdInput,10,m_AdjCohCheckDate);
m_StoredProc->Parameters->CreateParameter("@AdjCohPost",ftInteger,pdInput,1,m_AdjCohPost);
m_StoredProc->Parameters->CreateParameter("@AdjCohPoster",ftString,pdInput,18,m_AdjCohPoster);
m_StoredProc->Parameters->CreateParameter("@AdjCohPostDate",ftString,pdInput,10,m_AdjCohPostDate);
m_StoredProc->Parameters->CreateParameter("@AdjCohSysDate",ftString,pdOutput,40,m_AdjCohSysDate);
m_StoredProc->ExecProc();
m_StoredProc->Close();
m_AdjCohSysDate=m_StoredProc->Parameters->ParamValues["@AdjCohSysDate"];
break;
case 5:
case 6:
for(int i=0;i<ItemCount;i++)
{
LocateItemByIndex(i);
if(m_sdAdjCod->CurStatus==2||m_sdAdjCod->CurStatus==3)
m_sdAdjCod->Update();
}
break;
}
TsdAdjCoh *p=new TsdAdjCoh();
if(CurStatus==2)
{
SetActionID(1);
p->Assign(this);
AddRecord((void *)p,p->AdjCohCode);
}
else
{
SetActionID(1);
p->Assign(this);
ChangeRecord((void *)p,p->AdjCohCode,this->AdjCohCode);
}
}
//---------------------------------------------------------------------------
void TsdAdjCoh::Check(int IsCheck)
{
if(this->Count>0)
{
try
{
m_StoredProc->ProcedureName="sdAdjCoh_Check";
m_StoredProc->Parameters->Clear();
if(IsCheck==1)
{
AdjCohCheck=1;
AdjCohChecker=g_sdUserCode;
AdjCohCheckDate=g_sdCurDate;
m_StoredProc->Parameters->CreateParameter("@W_AdjCohCode",ftString,pdInput,20,b_AdjCohCode);
m_StoredProc->Parameters->CreateParameter("@AdjCohCheck",ftSmallint,pdInput,2,1);
m_StoredProc->Parameters->CreateParameter("@AdjCohChecker",ftString,pdInput,20,g_sdUserCode);
m_StoredProc->Parameters->CreateParameter("@AdjCohCheckDate",ftString,pdInput,10,g_sdCurDate);
m_StoredProc->ExecProc();
m_StoredProc->Close();
}
else
{
AdjCohCheck=0;
AdjCohChecker="";
AdjCohCheckDate="";
AnsiString temp="";
m_StoredProc->Parameters->CreateParameter("@W_AdjCohCode",ftString,pdInput,20,b_AdjCohCode);
m_StoredProc->Parameters->CreateParameter("@AdjCohCheck",ftSmallint,pdInput,2,0);
m_StoredProc->Parameters->CreateParameter("@AdjCohChecker",ftString,pdInput,20,temp);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -