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

📄 fmdoc.cpp

📁 邮 电 公 司 erp源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    BackupValue();
}

void TsdCac::Assign(TsdCac *p)
{
  SetActionID(p->CurStatus);
	m_CacCode=p->m_CacCode;
	m_CacBankName=p->m_CacBankName;
	m_CacType=p->m_CacType;
	m_CacCurrency=p->m_CacCurrency;
	m_CacBalance=p->m_CacBalance;
	m_CacDesc=p->m_CacDesc;
	m_CacGlKm=p->m_CacGlKm;
	m_CacKmDir=p->m_CacKmDir;
	m_CacCancel=p->m_CacCancel;
	m_CacCancelDate=p->m_CacCancelDate;
	m_CacUser=p->m_CacUser;
	m_CacSysDate=p->m_CacSysDate;
    BackupValue();
}

void TsdCac::AssignValue()
{
    TsdCac *p=(TsdCac *)Records(CurRecNo);
    Assign(p);
}

int TsdCac::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();
  ClearRecord();
  if(m_Query->RecordCount>0)
  {
    m_Query->First();
    while(!m_Query->Eof)
    {
      BatchLetValue();
      TsdCac *p=new TsdCac();
      SetActionID(1);
      p->Assign(this);
      AddRecord((void *)p,p->CacCode);
      m_Query->Next();
    }
    MoveFirst();
  }
  m_Query->Close();
  return Count;
}

bool TsdCac::Find(AnsiString WhereStr)
{
  AnsiString m_SqlStr;

  if(WhereStr.IsEmpty()==true)
    throw Exception("查找表达式不能为空");
  m_SqlStr="SELECT * FROM SDCac WHERE "+WhereStr;
  m_Query->Close();
  m_Query->SQL->Clear();
  m_Query->SQL->Add(m_SqlStr);
  m_Query->Open();
  if(m_Query->RecordCount!=1)
  {
    m_Query->Close();
    return false;
  }
  else
  {
    BatchLetValue();
    m_Query->Close();
    return true;
  }
}

TsdCac::~TsdCac()
{
  try{
  }
  catch(...)
  {
    throw Exception("析构函数出错");
  }
}
//**************************************
//     TsdInTax 个人所得税率
//**************************************
//--------------------------------------------------------------
void __fastcall TsdInTax:: SetInTaxLine(int   value)
{
    if(AnsiString(value).IsEmpty()==true)
      throw Exception("行号不能空");
    if(value<0)
      throw Exception("行号不能为负");
    if (value!=m_InTaxLine)
    {
      m_Query->Close();
      m_Query->SQL->Clear();
      m_Query->SQL->Add("SELECT InTaxLine FROM SDInTax WHERE InTaxLine='" +AnsiString(value)+"'");
      m_Query->Open();
      if(m_Query->RecordCount>0)
      {
        m_Query->Close();
        throw Exception("行号'"+AnsiString(value)+"'已存在");
      }
      m_Query->Close();
    }
       m_InTaxLine=value;
}
void __fastcall TsdInTax:: SetInTaxBegAmt(double  value)
{
      if(value<0)
       throw Exception("起始金额不能小于零");
       m_InTaxBegAmt=value;
}
void __fastcall TsdInTax:: SetInTaxEndAmt(double  value)
{
      if(value<0)
       throw Exception("结束金额不能小于零");
      if(m_InTaxBegAmt>=value)
       throw Exception("起始金额不能大于等于结束金额");
       m_InTaxEndAmt=value;
}
void __fastcall TsdInTax:: SetInTaxRate(double  value)
{
      if(value<=0 ||value>=100)
       throw Exception("税率不能小于等于'0'或大于等于'100'");
       m_InTaxRate=value;
}
//---------------------------------------------------------------------------
AnsiString TsdInTax::GetFieldValue(euInTax sdFieldName)
{
    switch(sdFieldName)
    {
      case fiInTaxLine:
           return InTaxLine;
      case fiInTaxBegAmt:
           return InTaxBegAmt;
      case fiInTaxEndAmt:
           return InTaxEndAmt;
      case fiInTaxRate:
           return InTaxRate;
      default:
           throw Exception("当前未定义可取值");
     }
}
//---------------------------------------------------------------------------
void TsdInTax::SetFieldValue(euInTax sdFieldName, AnsiString value)
{
    switch(sdFieldName)
     {
    case fiInTaxLine:  
         InTaxLine=value.ToInt();
          break;
    case fiInTaxBegAmt:  
         InTaxBegAmt=value.ToDouble();
          break;
    case fiInTaxEndAmt:
         InTaxEndAmt=value.ToDouble();
          break;
    case fiInTaxRate:
         InTaxRate=value.ToDouble();
          break;
    default:
         throw Exception("当前字段未定义可赋值");
      }
}
//---------------------------------------------------------------------------
TsdInTax::TsdInTax(TDataComm *DC)
                :TsdStandard(DC)
{
    try
    {
        EmptyValue(0);
        EmptyValue(1);
        QueryString="SELECT * FROM SDInTax";
        FilterString="";
        OrderString="InTaxLine";
    }
    catch(Exception &e)
    {
     throw Exception("构造函数出错");
    }
}
//---------------------------------------------------------------------------
TsdInTax::TsdInTax()
                :TsdStandard()
{
    try
    {
        EmptyValue(0);
        EmptyValue(1);
        QueryString="SELECT * FROM SDInTax";
        FilterString="";
        OrderString="InTaxLine";
    }
    catch(Exception &e)
    {
     throw Exception("构造函数出错");
    }
}
//---------------------------------------------------------------------------
TsdInTax::~TsdInTax()
{
  try{
     }
  catch(...)
    {
     throw Exception("析构函数出错");
    }
}
//---------------------------------------------------------------------------
void TsdInTax::BackupValue()
{
      b_InTaxLine=m_InTaxLine;
      b_InTaxBegAmt=m_InTaxBegAmt;
      b_InTaxEndAmt=m_InTaxEndAmt;
      b_InTaxRate=m_InTaxRate;
}
//---------------------------------------------------------------------------
void TsdInTax::RestoreValue()
{
      m_InTaxLine=b_InTaxLine;
      m_InTaxBegAmt=b_InTaxBegAmt;
      m_InTaxEndAmt=b_InTaxEndAmt;
      m_InTaxRate=b_InTaxRate;
}
//---------------------------------------------------------------------------
void TsdInTax::EmptyValue(int Index)
{
   switch(Index)
   {
    case 0:
        m_InTaxLine=0;
        m_InTaxBegAmt=0;
        m_InTaxEndAmt=0;
        m_InTaxRate=0;
    break;
    case 1:
        b_InTaxLine=0;
        b_InTaxBegAmt=0;
        b_InTaxEndAmt=0;
        b_InTaxRate=0;
      break;
     }
}
//---------------------------------------------------------------------------
void TsdInTax::BatchLetValue()
{
    m_InTaxLine=m_Query->FieldValues["InTaxLine"];
    m_InTaxBegAmt=m_Query->FieldValues["InTaxBegAmt"];
    m_InTaxEndAmt=m_Query->FieldValues["InTaxEndAmt"];
    m_InTaxRate=m_Query->FieldValues["InTaxRate"];
    BackupValue();
}
//---------------------------------------------------------------------------
void TsdInTax::Update()
{
    if(CurStatus==0||CurStatus==1)
        throw Exception("当前不是编辑状态,不能进行存盘操作!");
   if(AnsiString(m_InTaxLine).IsEmpty()==true)
      throw Exception("行号不能空");
    if(m_InTaxLine<0)
        throw Exception("行号不能为负!");
    m_StoredProc->Close();
    if(CurStatus==2||CurStatus==4)
      {
        m_StoredProc->ProcedureName="sdInTax_Insert";
        m_StoredProc->Parameters->Clear();
        m_StoredProc->Parameters->CreateParameter("@InTaxLine",ftFloat,pdInput,5,m_InTaxLine);
        m_StoredProc->Parameters->CreateParameter("@InTaxBegAmt",ftFloat,pdInput,12,m_InTaxBegAmt);
        m_StoredProc->Parameters->CreateParameter("@InTaxEndAmt",ftFloat,pdInput,12,m_InTaxEndAmt);
        m_StoredProc->Parameters->CreateParameter("@InTaxRate",ftFloat,pdInput,12,m_InTaxRate);

        m_StoredProc->ExecProc();
   }
  else
    {
        m_StoredProc->ProcedureName="sdInTax_Update";
        m_StoredProc->Parameters->Clear();

        m_StoredProc->Parameters->CreateParameter("@W_InTaxLine",ftString,pdInput,5,b_InTaxLine);
        m_StoredProc->Parameters->CreateParameter("@InTaxLine",ftFloat,pdInput,5,m_InTaxLine);
        m_StoredProc->Parameters->CreateParameter("@InTaxBegAmt",ftFloat,pdInput,12,m_InTaxBegAmt);
        m_StoredProc->Parameters->CreateParameter("@InTaxEndAmt",ftFloat,pdInput,12,m_InTaxEndAmt);
        m_StoredProc->Parameters->CreateParameter("@InTaxRate",ftFloat,pdInput,12,m_InTaxRate);

       m_StoredProc->ExecProc();
    }
  TsdInTax *p=new TsdInTax();
  if(CurStatus==2)
    {
     SetActionID(1);
     p->Assign(this);
     AddRecord((void *)p,p->InTaxLine);
     }
  else
    {
     SetActionID(1);
     p->Assign(this);
     ChangeRecord((void *)p,p->InTaxLine,this->b_InTaxLine);
    }
}
//---------------------------------------------------------------------------
void TsdInTax::Delete()
{
    if(CurStatus!=1)
        throw Exception("当前状态不能进行删除操作!");
    if(AnsiString(m_InTaxLine).IsEmpty()==true)
       throw Exception("当前没有记录可以删除!");
    m_StoredProc->Close();
    m_StoredProc->ProcedureName="sdInTax_Delete";
    m_StoredProc->Parameters->Clear();
        m_StoredProc->Parameters->CreateParameter("@W_InTaxLine",ftString,pdInput,5,b_InTaxLine);
    m_StoredProc->ExecProc();
    DeleteRecord(this->b_InTaxLine);
}
//---------------------------------------------------------------------------
void TsdInTax::Assign(TsdInTax *p)
{
    this->SetActionID(p->CurStatus);
    this->m_InTaxLine=p->m_InTaxLine;
    this->m_InTaxBegAmt=p->m_InTaxBegAmt;
    this->m_InTaxEndAmt=p->m_InTaxEndAmt;
    this->m_InTaxRate=p->m_InTaxRate;
    this->BackupValue();
}
//---------------------------------------------------------------------------
void TsdInTax::AssignValue()
{
    TsdInTax *p=(TsdInTax *)Records(CurRecNo);
    Assign(p);
}
//---------------------------------------------------------------------------
int TsdInTax::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();
    ClearRecord();
    if(m_Query->RecordCount>0)
    {
        m_Query->First();
        while(!m_Query->Eof)
        {
            BatchLetValue();
            TsdInTax *p=new TsdInTax();
            SetActionID(1);
            p->Assign(this);
            AddRecord((void *)p,p->InTaxLine);
            m_Query->Next();
        }
        MoveFirst();
    }
    m_Query->Close();
    return Count;
}
//---------------------------------------------------------------------------
bool TsdInTax::Find(AnsiString WhereStr)
{
    AnsiString m_SqlStr;
    if(WhereStr.IsEmpty()==true)
        throw Exception("查找表达式不能为空");
    m_SqlStr="select * from SdInTax where  "+WhereStr;
    m_Query->Close();
    m_Query->SQL->Clear();
    m_Query->SQL->Add(m_SqlStr);
    m_Query->Open();
    if(m_Query->RecordCount!=1)
    {
        m_Query->Close();
        return false;
    }
    else
    {
        BatchLetValue();
        m_Query->Close();
        return true;
    }
}

//**************************************
//     TsdFvct  凭证类别
//**************************************
//--------------------------------------------------------------
void __fastcall TsdFvct:: SetFvctCode(AnsiString value)
{
   if(value.IsEmpty())
       throw Exception("类别编码不能为空");
    if(value.Length()>18)
       throw Exception("类别编码长度不能超过18");
    if (value != m_FvctCode)
    {
       m_Query->Close();
       m_Query->SQL->Clear();
       m_Query->SQL->Add("SELECT FvctCode FROM SDFvct WHERE FvctCode='"+value+"'");
       m_Query->Open();
       if(m_Query->RecordCount>0)
       {
          m_Query->Close();
          throw Exception("类别编码已存在!");
       }
       m_Query->Close();
    }
    m_FvctCode=value;
}
void __fastcall TsdFvct:: SetFvctName(AnsiString value)
{
   if(value.IsEmpty())
       throw Exception("类别名称不能为空");
    if(value.Length()>20)
       throw Exception("类别名称长度不能超过20");
    if (value != m_FvctName)
    {
       m_Query->Close();
       m_Query->SQL->Clear();
       m_Query->SQL->Add("SELECT FvctName FROM SDFvct WHERE FvctName='"+value+"'");

⌨️ 快捷键说明

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