📄 mclient.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "mClient.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
TKSClient *sdClient;
//---------------------------------------------------------------------------
__fastcall TKSClient::TKSClient()
:TKSMidBase()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidMasterField(int FieldNo)
{
switch(FieldNo)
{
case 1: //客户代码
ValidClientCode();
break;
case 2: //客户名称
ValidClientName();
break;
case 3: //备注
ValidClientDesc();
break;
case 4: //客户类型
ValidClientType();
break;
case 5: //法人代表
ValidClientLegalman();
break;
case 6: //联系人
ValidClientLinkman();
break;
case 7: //地址
ValidClientAddr();
break;
case 8: //邮政编码
ValidClientZip();
break;
case 9: //电话
ValidClientTel();
break;
case 10: //传真
ValidClientFax();
break;
case 11: //E-mail
ValidClientEmail();
break;
case 12: //信誉度
ValidClientCredit();
break;
case 13: //信用期限
ValidClientCreditTerm();
break;
case 14: //停用
ValidClientCancel();
break;
case 15: //停用日期
ValidClientCancelDate();
break;
case 16: //建立日期
ValidClientCreateDate();
break;
case 17: //币种
ValidClientCurrency();
break;
case 18: //税码
ValidClientTaxCode();
break;
case 19: //税号
ValidClientTaxNo();
break;
case 20: //所在地区
ValidClientArea();
break;
case 21: //销售类型
ValidClientSmode();
break;
case 22: //销售员
ValidClientSaler();
break;
case 23: //所属行业
ValidClientTrade();
break;
case 30: //价格类型
ValidClientSpt();
break;
}
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientCode() //客户代码
{
/*
AnsiString m_ClientCode;
AnsiString b_ClientCode;
m_ClientCode=GetMasterValue("ClientCode");
b_ClientCode=GetMasterOldValue("ClientCode");
if (m_ClientCode.IsEmpty() )
throw Exception("客户编码不能为空!");
if(m_ClientCode.Length()>18)
throw Exception("客户编码长度不能大于18");
if (m_ClientCode.UpperCase()!=b_ClientCode.LowerCase().UpperCase())
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("SELECT CLIENTCODE FROM SDCLIENT WHERE CLIENTCODE='" +m_ClientCode+"'");
Query->Open();
if(Query->RecordCount>0)
{
Query->Close();
throw Exception("客户编码'"+m_ClientCode+"'已存在");
}
Query->Close();
}
*/
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientName() //客户名称
{
AnsiString m_ClientName;
AnsiString b_ClientName;
m_ClientName=GetMasterValue("ClientName");
b_ClientName=GetMasterOldValue("ClientName");
if(m_ClientName.LowerCase().IsEmpty())
throw Exception("客户名称不能为空");
if(m_ClientName.LowerCase().Length()>40)
throw Exception("客户名称长度不能大于40");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientDesc() //备注
{
AnsiString m_ClientDesc;
AnsiString b_ClientDesc;
m_ClientDesc=GetMasterValue("ClientDesc");
b_ClientDesc=GetMasterOldValue("ClientDesc");
if(m_ClientDesc.LowerCase().Length()>40)
throw Exception("备注长度不能大于40");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientType() //客户类型
{
/* AnsiString m_ClientType;
AnsiString b_ClientType;
m_ClientType=GetMasterValue("ClientType");
b_ClientType=GetMasterOldValue("ClientType");
if(m_ClientType.LowerCase().IsEmpty())
throw Exception("客户类型不能为空");
if(m_ClientType.LowerCase().Length()>18)
throw Exception("客户类型长度不能大于18");
if(m_ClientType.LowerCase()!=b_ClientType.LowerCase())
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("Select StypeCode from sdStype where StypeCode='"+m_ClientType+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("客户类型:'"+m_ClientType+"'未定义");
}
Query->Close();
}
*/
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientLegalman() //法人代表
{
AnsiString m_ClientLegalman;
AnsiString b_ClientLegalman;
m_ClientLegalman=GetMasterValue("ClientLegalman");
b_ClientLegalman=GetMasterOldValue("ClientLegalman");
if(m_ClientLegalman.LowerCase().Length()>18)
throw Exception("法人长度不能大于18");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientLinkman() //联系人
{
AnsiString m_ClientLinkman;
AnsiString b_ClientLinkman;
m_ClientLinkman=GetMasterValue("ClientLinkman");
b_ClientLinkman=GetMasterOldValue("ClientLinkman");
if(m_ClientLinkman.LowerCase().Length()>18)
throw Exception("联系人长度不能大于18");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientAddr() //地址
{
AnsiString m_ClientAddr;
m_ClientAddr=GetMasterValue("ClientAddr");
if(m_ClientAddr.LowerCase().Length()>40)
throw Exception("客户地址长度不能大于40");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientZip() //邮政编码
{
AnsiString m_ClientZip;
m_ClientZip=GetMasterValue("ClientZip");
if(m_ClientZip.LowerCase().Length()>6)
throw Exception("邮政编码长度不能大于6");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientTel() //电话
{
AnsiString m_ClientTel;
m_ClientTel=GetMasterValue("ClientTel");
if(m_ClientTel.LowerCase().Length()>18)
throw Exception("客户电话长度不能大于18");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientFax() //传真
{
AnsiString m_ClientFax;
m_ClientFax=GetMasterValue("ClientFax");
if(m_ClientFax.LowerCase().Length()>18)
throw Exception("传真长度不能大于18");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientEmail() //E-mail
{
AnsiString m_ClientEmail;
m_ClientEmail=GetMasterValue("ClientEmail");
if(m_ClientEmail.LowerCase().Length()>20)
throw Exception("E-MAIL长度不能大于20");
}
//---------------------------------------------------------------------------
void __fastcall TKSClient::ValidClientCredit() //信誉度
{
/* AnsiString m_ClientCredit;
AnsiString b_ClientCredit;
m_ClientCredit=GetMasterValue("ClientCredit");
b_ClientCredit=GetMasterOldValue("ClientCredit");
if(m_ClientCredit.LowerCase().IsEmpty())
throw Exception("信誉度编码不能为空");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -