📄 msogh_n.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "mSogh_N.h"
#include "zcomfun.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
TKSSogh_N *sdSogh_n;
//---------------------------------------------------------------------------
__fastcall TKSSogh_N::TKSSogh_N()
:TKSMidBase()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidMasterField(int FieldNo)
{
switch(FieldNo)
{
case 1: //发货单号
ValidSoghCode();
break;
case 2: //发货单日期
ValidSoghDate();
break;
case 3: //财务月份
ValidSoghFmonth();
break;
case 4: //收发类型
ValidSoghPosType();
break;
case 5: //发货单类型
ValidSoghType();
break;
case 6: //客户编号
ValidSoghClient();
break;
case 7: //币种
ValidSoghCurrency();
break;
case 8: //汇率
ValidSoghEnrate();
break;
case 9: //税名
ValidSoghTaxCode();
break;
case 10: //结算方式
ValidSoghSettleMode();
break;
case 11: //交货地址
ValidSoghSsite();
break;
case 12: //交货方式
ValidSoghDeliver();
break;
case 13: //运输方式
ValidSoghTransMode();
break;
case 14: //货运单号
ValidSoghTransCode();
break;
case 15: //业务员
ValidSoghSaler();
break;
case 16: //制单人
ValidSoghUser();
break;
case 18: //备注
ValidSoghDesc();
break;
case 19: //审核
ValidSoghCheck();
break;
case 20: //审核人
ValidSoghChecker();
break;
case 21: //审核日期
ValidSoghCheckDate();
break;
case 22: //结清
ValidSoghClose();
break;
case 23: //取消
ValidSoghCancel();
break;
case 24: //取消日期
ValidSoghCancelDate();
break;
case 25: //取消原因
ValidSoghCr();
break;
}
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghCode() //发货单号
{ /*
AnsiString m_SoghCode;
AnsiString b_SoghCode;
m_SoghCode=ReturnNeedValue(GetMasterValue("SoghCode"),"");
b_SoghCode=ReturnNeedValue(GetMasterOldValue("SoghCode"),"");
if(m_SoghCode.IsEmpty())
throw Exception("销售发货单的单号不能为空!");
if(m_SoghCode.Length()>18)
throw Exception("销售发货单号长度不能大于18");
if(m_SoghCode.UpperCase()!= b_SoghCode.UpperCase())
{
Query->Close();
Query->SQL->Clear(),
Query->SQL->Add("select SoghCode from sdSogh where SoghCode='"+m_SoghCode+"'");
Query->Open();
if(Query->RecordCount>0)
{
Query->Close();
throw Exception("已经存在发货单号:'"+m_SoghCode+"',不能重复.");
}
Query->Close();
} */
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghDate() //发货单日期
{
AnsiString m_SoghDate;
m_SoghDate=ReturnNeedValue(GetMasterValue("SoghDate"),"");
if(m_SoghDate.IsEmpty())
throw Exception("发货日期不能为空");
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghFmonth() //财务月份
{
AnsiString m_SoghFmonth;
m_SoghFmonth=ReturnNeedValue(GetMasterValue("SoghFmonth"),"");
AnsiString s;
if(m_SoghFmonth.IsEmpty())
throw Exception("财务月份不能为空");
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghPosType() //收发类型
{ /*
AnsiString m_SoghPosType;
AnsiString b_SoghPosType;
m_SoghPosType=ReturnNeedValue(GetMasterValue("SoghPosType"),"");
b_SoghPosType=ReturnNeedValue(GetMasterOldValue("SoghPosType"),"");
if(m_SoghPosType.IsEmpty())
throw Exception("收发类型的定义不能为空.");
if(m_SoghPosType.Length()>18)
throw Exception("收发存类型代码长度不能大于18");
if(m_SoghPosType!=b_SoghPosType)
{
Query->Close();
Query->SQL->Clear(),
Query->SQL->Add("select PosTypeCode from sdPosType where PosTypeCode='"+m_SoghPosType+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("收发存类型:'"+m_SoghPosType+"',未定义.");
}
Query->Close();
} */
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghType() //发货单类型
{
int m_SoghType;
m_SoghType=ReturnNeedValue(GetMasterValue("SoghType"),0);
if(m_SoghType!=1 && m_SoghType!=2)
throw Exception("发货类型只能取值1-据订单发货,2-按客户发货");
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghClient() //客户编号
{ /*
AnsiString m_SoghClient;
AnsiString b_SoghClient;
m_SoghClient=ReturnNeedValue(GetMasterValue("SoghClient"),"");
b_SoghClient=ReturnNeedValue(GetMasterOldValue("SoghClient"),"");
if(m_SoghClient.IsEmpty())
throw Exception("客户编码不能为空!!!");
if(m_SoghClient.Length()>18)
throw Exception("客户编码长度不能大于18");
if(m_SoghClient != b_SoghClient)
{
Query->Close();
Query->SQL->Clear(),
Query->SQL->Add("select ClientName from sdClient where ClientCode='"+m_SoghClient+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("客户:"+m_SoghClient+"不存在");
}
Query->Close();
} */
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghCurrency() //币种
{ /*
AnsiString m_SoghCurrency;
AnsiString b_SoghCurrency;
AnsiString m_SoghClient=ReturnNeedValue(GetMasterValue("SoghClient"),"");
m_SoghCurrency=ReturnNeedValue(GetMasterValue("SoghCurrency"),"");
b_SoghCurrency=ReturnNeedValue(GetMasterOldValue("SoghCurrency"),"");
if(m_SoghCurrency.IsEmpty())
throw Exception("币种不能为空");
if(m_SoghCurrency.Length()>18)
throw Exception("币种长度不能大于18");
if(m_SoghClient.IsEmpty())
throw Exception("客户代码不能为空");
if(m_SoghCurrency!=b_SoghCurrency)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select Currencycode,currencylocal from sdCurrency,sdssd where Currencycode='"+m_SoghCurrency+"' and currencycode=ssdcurrency and ssdclient='"+m_SoghClient+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("币种:"+m_SoghCurrency+"不存在");
}
// if(Query->FieldValues["currencylocal"]==1)
// SetMasterValue("SoghEnrate",1);
Query->Close();
} */
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghEnrate() //汇率
{ /*
double m_SoghEnrate;
double b_SoghEnrate;
AnsiString m_SoghClient=ReturnNeedValue(GetMasterValue("SoghClient"),"");
AnsiString m_SoghCurrency=ReturnNeedValue(GetMasterValue("SoghCurrency"),"");
m_SoghEnrate=ReturnNeedValue(GetMasterValue("SoghEnrate"),0);
b_SoghEnrate=ReturnNeedValue(GetMasterOldValue("SoghEnrate"),0);
AnsiString FCurrency;
if(m_SoghCurrency.IsEmpty())
throw Exception("币种代码不能为空");
if(m_SoghClient.IsEmpty())
throw Exception("客户代码不能为空");
if(m_SoghEnrate!=b_SoghEnrate)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select currencycode from sdCurrency where currencylocal=1");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("本币未定义");
}
FCurrency=Query->FieldValues["currencycode"];
Query->Close();
} */
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghTaxCode() //税名
{ /*
AnsiString m_SoghTaxCode;
AnsiString b_SoghTaxCode;
m_SoghTaxCode=ReturnNeedValue(GetMasterValue("SoghTaxCode"),"");
b_SoghTaxCode=ReturnNeedValue(GetMasterOldValue("SoghTaxCode"),"");
if(m_SoghTaxCode.Length()>18)
throw Exception("税码长度不能大于18");
if(m_SoghTaxCode.IsEmpty()==false && m_SoghTaxCode!=b_SoghTaxCode)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select Taxcode from sdTax where taxcode='"+m_SoghTaxCode+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("税码:"+m_SoghTaxCode+"不存在");
}
Query->Close();
} */
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghSettleMode() //结算方式
{ /*
AnsiString m_SoghSettleMode;
AnsiString b_SoghSettleMode;
m_SoghSettleMode=ReturnNeedValue(GetMasterValue("SoghSettleMode"),"");
b_SoghSettleMode=ReturnNeedValue(GetMasterOldValue("SoghSettleMode"),"");
if(m_SoghSettleMode.Length()>18)
throw Exception("结算方式代码长度不能大于18");
if(m_SoghSettleMode.IsEmpty()==false && m_SoghSettleMode!=b_SoghSettleMode)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("Select SettleModecode from sdSettleMode where Settlemodecode='"+m_SoghSettleMode+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("结算方式不存在");
}
Query->Close();
} */
}
//---------------------------------------------------------------------------
void __fastcall TKSSogh_N::ValidSoghSsite() //交货地址
{ /*
AnsiString m_SoghSsite;
AnsiString b_SoghSsite;
AnsiString m_SoghClient=ReturnNeedValue(GetMasterValue("SoghClient"),"");
m_SoghSsite=ReturnNeedValue(GetMasterValue("SoghSsite"),"");
b_SoghSsite=ReturnNeedValue(GetMasterOldValue("SoghSsite"),"");
if(m_SoghSsite.IsEmpty())
throw Exception("交货地址不能为空");
if(m_SoghSsite.Length()>18)
throw Exception("交货地址长度不能大于18");
if(m_SoghClient.IsEmpty())
throw Exception("客户代码不能为空");
if(m_SoghSsite!=b_SoghSsite)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select Ssitecode from sdSsite where Ssitecode='"+m_SoghSsite+"' and ssiteclient='"+m_SoghClient+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("交货地址未定义");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -