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

📄 qu_scmbh.cpp

📁 速达开源ERP系统
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Qu_Scmbh.h"
#include "Qu_Scmbd.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "QueryBaseForm"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmQu_Scmbh *frmQu_Scmbh;
//---------------------------------------------------------------------------
__fastcall TfrmQu_Scmbh::TfrmQu_Scmbh(TComponent* Owner)
        : TQueryBaseForm(Owner)
{
       m_FilterStr=""; //查询条件字串
       m_SQL="";      //查询语句
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::ClearControl(bool BringToNext)
{
 return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::GetDataFromComObject()
{
 return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::WaitUserInput()
{
 return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::RefreshGridData(int mAction)
{
 return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::DisplayBill()
{
 return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::GetBill(AnsiString BillID)
{
 return;
}
//---------------------------------------------------------------------------
bool __fastcall TfrmQu_Scmbh::ShowQueryWindow()
{
  TfrmQuForm *FQuery=new TfrmQuForm(this,this->Name);
  FQuery->ShowModal();
  if(FQuery->CancelQuery)
    return false;
  m_FilterStr=FQuery->CreateSqlString;
  delete FQuery;
  return true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::FillGridWithData()
{
  TComResultSet *RsQuery=NewResultSet();
  AnsiString  ItemStr="";
  if(m_FilterStr=="")
    m_FilterStr="";
  else
    m_FilterStr=" where "+m_FilterStr;
  m_SQL=" select distinct  ScmbhCode,ScmbhDate,ScmbhFmonth,ScmbhDesc, ScmbhOCost,ScmbhNCost,";
  m_SQL=m_SQL+"ScmbhCheck,ScmbhUser,ScmbhChecker, ScmbhSysDate from sdVW_Scmbh  "+m_FilterStr+" order by ScmbhCODE";
  sgScmbh->RowCount=1;
  try
  {
    RsQuery->Open(m_SQL,"");
    RsQuery->MoveFirst();
    while( RsQuery->Eof == 0)
    {
      ItemStr="\t"+RsQuery->FieldByName("ScmbhCODE")+
          "\t"+RsQuery->FieldByName("ScmbhDATE")+
          "\t"+RsQuery->FieldByName("ScmbhFMONTH")+
          "\t"+RsQuery->FieldByName("ScmbhDESC")+
          "\t"+RsQuery->FieldByName("ScmbhOCost")+
          "\t"+RsQuery->FieldByName("ScmbhNCost")+
          "\t"+(RsQuery->FieldByName("ScmbhCheck")=="1" ?"是":"否")+
          "\t"+RsQuery->FieldByName("ScmbhUser")+
          "\t"+RsQuery->FieldByName("ScmbhChecker")+
          "\t"+RsQuery->FieldByName("ScmbhSysDate");
      sgScmbh->AddItem(ItemStr);
      RsQuery->MoveNext();
    }
    RsQuery->Close();
  }
  __finally
  {
    delete RsQuery;
  }
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::tbQueryClick(TObject *Sender)
{
  if(!ShowQueryWindow())
    return;
  try{
    StartWaitForm("正在查询,请稍候...");
    FillGridWithData();
  }
  __finally
  {
    EndWaitForm();
  }

}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::tbRefreshClick(TObject *Sender)
{
    if(m_SQL=="")
      FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::muFirstClick(TObject *Sender)
{
   if(sgScmbh->RowCount > 1)
    sgScmbh->Row=1;
        
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::muPreviousClick(TObject *Sender)
{
   if( sgScmbh->RowCount > 2)
     sgScmbh->Row=sgScmbh->Row-1;

}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::muNextClick(TObject *Sender)
{
 if(sgScmbh->RowCount > 1 && sgScmbh->Row < sgScmbh->RowCount-1)
  sgScmbh->Row=sgScmbh->Row+1;

}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::muLastClick(TObject *Sender)
{
   if(sgScmbh->RowCount > 1)
    sgScmbh->Row=sgScmbh->RowCount-1;

}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Scmbh::sgScmbhDblClick(TObject *Sender)
{
   if(sgScmbh->Row>0 &&sgScmbh->Row<sgScmbh->RowCount)    //当前行无效
     {
      TfrmQu_Scmbd *m_Scmbd= new TfrmQu_Scmbd(this,sgScmbh->TextMatrix[sgScmbh->Row][1]);
      m_Scmbd->ShowModal();
      delete m_Scmbd;
     }

}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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