⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msreth.cpp

📁 科思ERP部分源码及控件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include "mSreth.h"
#include "zcomfun.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)
TKSSreth *sdSreth;
//---------------------------------------------------------------------------
__fastcall TKSSreth::TKSSreth()
  :TKSMidBase()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidMasterField(int FieldNo)
{
  switch(FieldNo)
  {
    case 1:  //退货单号
      ValidSrethCode();
      break;
    case 2:  //退货日期
      ValidSrethDate();
      break;
    case 3:  //财务月份
      ValidSrethFmonth();
      break;
    case 4:  //退货类型
      ValidSrethType();
      break;
    case 5:  //收发类型
      ValidSrethPosType();
      break;
    case 6:  //客户编码
      ValidSrethClient();
      break;
    case 7:  //币种
      ValidSrethCurrency();
      break;
    case 8:  //汇率
      ValidSrethEnrate();
      break;
    case 9:  //税名
      ValidSrethTaxCode();
      break;
    case 10:  //货运地址
      ValidSrethSsite();
      break;
    case 11:  //交货方式
      ValidSrethDeliver();
      break;
    case 12:  //结算方式
      ValidSrethSettleMode();
      break;
    case 13:  //运输方式
      ValidSrethTransMode();
      break;
    case 14:  //退货原因
      ValidSrethRr();
      break;
    case 15:  //业务员
      ValidSrethSaler();
      break;
    case 16:  //操作员
      ValidSrethUser();
      break;
    case 17:  //备注
      ValidSrethDesc();
      break;
    case 18:  //审核
      ValidSrethCheck();
      break;
    case 19:  //审核人
      ValidSrethChecker();
      break;
    case 20:  //审核日期
      ValidSrethCheckDate();
      break;
    case 21:  //结清
      ValidSrethClose();
      break;
    case 22:  //取消
      ValidSrethCancel();
      break;
    case 23:  //取消日期
      ValidSrethCancelDate();
      break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethCode()  //退货单号
{                            /*/
   AnsiString  m_SrethCode;
   AnsiString  b_SrethCode;
   m_SrethCode=ReturnNeedValue(GetMasterValue("SrethCode"),"");
   b_SrethCode=ReturnNeedValue(GetMasterOldValue("SrethCode"),"");
    if(m_SrethCode.IsEmpty())
        throw Exception("退货单单头编码不能为空!");
    if(m_SrethCode.UpperCase()!=  b_SrethCode.UpperCase())
    {
        Query->Close();
        Query->SQL->Clear();
        Query->SQL->Add("SELECT SrethCODE FROM SDSreth WHERE SrethCODE='" +m_SrethCode+"'");
        Query->Open();
        if(Query->RecordCount>0)
        {
            Query->Close();
            throw Exception("退货单单头编码'"+m_SrethCode+"'已存在");
        }
        Query->Close();
    }                           /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethDate()  //退货日期
{
   AnsiString  m_SrethDate;
   m_SrethDate=ReturnNeedValue(GetMasterValue("SrethDate"),"");
    if(m_SrethDate.IsEmpty())
     throw Exception("制单日期不能为空");
//      throw Exception("制单单日期不能小于当前日期");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethFmonth()  //财务月份
{
   AnsiString  m_SrethFmonth;
   AnsiString  b_SrethFmonth;
   m_SrethFmonth=ReturnNeedValue(GetMasterValue("SrethFmonth"),"");
   b_SrethFmonth=ReturnNeedValue(GetMasterOldValue("SrethFmonth"),"");
    if(m_SrethFmonth.IsEmpty())
        throw Exception("退货单的财务月份不能为空!!!");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethType()  //退货类型
{
   int m_SrethType;
   m_SrethType=ReturnNeedValue(GetMasterValue("SrethType"),-1);
    if(m_SrethType!=1 && m_SrethType!=2)
      throw Exception("退货类型只能取值:1-据发货单退货,2-据客户退货");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethPosType()  //收发类型
{                          /*/
   AnsiString  m_SrethPosType;
   AnsiString  b_SrethPosType;
   m_SrethPosType=ReturnNeedValue(GetMasterValue("SrethPosType"),"");
   b_SrethPosType=ReturnNeedValue(GetMasterOldValue("SrethPosType"),"");
    if(m_SrethPosType.IsEmpty())
      throw Exception("收发类型不能为空!");
    if(m_SrethPosType.Length()>18)
      throw Exception("收发存类型代码长度不能大于18");
    if(m_SrethPosType!=b_SrethPosType)
    {
      Query->Close();
      Query->SQL->Clear(),
      Query->SQL->Add("select PosTypeCode from sdPosType where PosTypeCode='"+m_SrethPosType+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("收发存类型:'"+m_SrethPosType+"',未定义.");
      }
      Query->Close();
    }                         /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethClient()  //客户编码
{                            /*/
   AnsiString  m_SrethClient;
   AnsiString  b_SrethClient;
   m_SrethClient=ReturnNeedValue(GetMasterValue("SrethClient"),"");
   b_SrethClient=ReturnNeedValue(GetMasterOldValue("SrethClient"),"");
    if(m_SrethClient.IsEmpty())
        throw Exception("客户编码不能为空!!");
    if(m_SrethClient != b_SrethClient)
    {
        Query->Close();
        Query->SQL->Clear(),
        Query->SQL->Add("select ClientName from sdClient where ClientCode='"+m_SrethClient+"'");
        Query->Open();
        if(Query->RecordCount<1)
        {
            Query->Close();
            throw Exception("客户不存在");
        }
        Query->Close();
    }                           /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethCurrency()  //币种
{                          /*/
   AnsiString  m_SrethCurrency;
   AnsiString  b_SrethCurrency;
   AnsiString  m_SrethClient=ReturnNeedValue(GetMasterValue("SrethClient"),"");
   m_SrethCurrency=ReturnNeedValue(GetMasterValue("SrethCurrency"),"");
   b_SrethCurrency=ReturnNeedValue(GetMasterOldValue("SrethCurrency"),"");
    if(m_SrethCurrency.IsEmpty())
      throw Exception("货币编码不能为空");
    if(m_SrethClient.IsEmpty())
      throw Exception("客户编码不能为空");
    if(m_SrethCurrency!=b_SrethCurrency)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select currencycode from sdcurrency,sdssd where ssdcurrency=currencycode and currencycode='"+m_SrethCurrency+"' and ssdClient='"+m_SrethClient+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("客户币种代码:"+m_SrethCurrency+"未定义");
      }
      Query->Close();
    }                         /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethEnrate()  //汇率
{                          /*/
  double m_SrethEnrate;
  double b_SrethEnrate;
  AnsiString m_SrethCurrency=ReturnNeedValue(GetMasterValue("SrethCurrency"),"");
   m_SrethEnrate=ReturnNeedValue(GetMasterValue("SrethEnrate"),0);
   b_SrethEnrate=ReturnNeedValue(GetMasterOldValue("SrethEnrate"),0);
    if(m_SrethEnrate<=0)
      throw Exception("汇率需大于零");
    if(m_SrethCurrency.IsEmpty())
      throw Exception("币种不能为空");
    if(m_SrethEnrate!=b_SrethEnrate)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select currencylocal from sdcurrency where currencyCode='"+m_SrethCurrency+"'");
      Query->Open();
      if(Query->RecordCount<1)
      {
        Query->Close();
        throw Exception("当前币种不存在");
      }
//      if(Query->FieldValues["CurrencyLocal"]==1)
//        b_SrethEnrate=1;
      Query->Close();
    }                         /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethTaxCode()  //税名
{                            /*/
   AnsiString  m_SrethTaxCode;
   AnsiString  b_SrethTaxCode;
   m_SrethTaxCode=ReturnNeedValue(GetMasterValue("SrethTaxCode"),"");
   b_SrethTaxCode=ReturnNeedValue(GetMasterOldValue("SrethTaxCode"),"");
   if(m_SrethTaxCode.IsEmpty())
     throw Exception("税码不能为空");
   if(m_SrethTaxCode!=b_SrethTaxCode)
     {
        Query->Close();
        Query->SQL->Clear(),
        Query->SQL->Add("select TaxCode from sdTax where TaxCode='"+m_SrethTaxCode+"'");
        Query->Open();
        if(Query->RecordCount<0)
          {
           Query->Close();
           throw Exception("税码不存在!");
          }
        Query->Close();
       }                        /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethSsite()  //货运地址
{                        /*/
   AnsiString  m_SrethSsite;
   AnsiString  b_SrethSsite;
   AnsiString m_SrethClient=ReturnNeedValue(GetMasterValue("SrethClient"),"");
   m_SrethSsite=ReturnNeedValue(GetMasterValue("SrethSsite"),"");
   b_SrethSsite=ReturnNeedValue(GetMasterOldValue("SrethSsite"),"");
  if(m_SrethSsite.IsEmpty())
    throw Exception("交货地址不能为空!");
  if(m_SrethClient.IsEmpty())
    throw Exception("客户编码不能为空");
  {
    Query->Close();
    Query->SQL->Clear();
    Query->SQL->Add("select ssitecode from sdssite where ssiteclient='"+m_SrethClient+"' and SsiteCode='"+m_SrethSsite+"'");
    Query->Open();
    if(Query->RecordCount<1)
    {
      Query->Close();
      throw Exception("客户未定义当前交货地址");
    }
    Query->Close();
  }                         /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethDeliver()  //交货方式
{                        /*/
   AnsiString  m_SrethDeliver;
   AnsiString  b_SrethDeliver;
   m_SrethDeliver=ReturnNeedValue(GetMasterValue("SrethDeliver"),"");
   b_SrethDeliver=ReturnNeedValue(GetMasterOldValue("SrethDeliver"),"");
  if(m_SrethDeliver.IsEmpty())
    throw Exception("交货方式不能为空!");
  {
    Query->Close();
    Query->SQL->Clear();
    Query->SQL->Add("select delivercode from sddeliver where delivercode='"+m_SrethDeliver+"'");
    Query->Open();
    if(Query->RecordCount<1)
    {
      Query->Close();
      throw Exception("交货方式不存在");
    }
    Query->Close();
  }                         /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSrethSettleMode()  //结算方式
{
   AnsiString  m_SrethSettleMode;
   AnsiString  b_SrethSettleMode;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -