qu_apgl.cpp

来自「一个以前收集的基于C/S架构的ERP客户端源代码」· C++ 代码 · 共 165 行

CPP
165
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Qu_Apgl.h"
#include "Qu_Apcl.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SDGrid"
#pragma link "QueryBaseForm"
#pragma link "KSAdvReport"
#pragma resource "*.dfm"
TfrmQu_Apgl *frmQu_Apgl;
//---------------------------------------------------------------------------
__fastcall TfrmQu_Apgl::TfrmQu_Apgl(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
        : TQueryBaseForm(Owner,chWnd,MidCode,WhereStr)
{
    m_SQL="";      //查询语句
    QueryGrid=sgApgl;
    RsQuery=new  TComResultSet(Handle,g_ClientHandle);
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::ClearControl(bool BringToNext)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::GetDataFromComObject()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::WaitUserInput()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::RefreshGridData(int mAction)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::DisplayBill()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::GetBill(AnsiString BillID)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::FillGridWithData()
{

    AnsiString  ItemStr="",m_FiStr="";
    if(FilterStr=="")
       m_FiStr="";
    else
       m_FiStr=" where "+FilterStr;
     m_SQL=" select * from sdVW_Apgl "+m_FiStr+" order by ApglFmonth";
     sgApgl->RowCount=1;
     RsQuery->Close();
     RsQuery->Open(m_SQL,"");
     RsQuery->MoveFirst();
     while( RsQuery->Eof == 0)
     {
      ItemStr= "\t" +RsQuery->FieldByName("ApglFmonth")    +
              "\t" +RsQuery->FieldByName("ApglSupplyName")    +
              "\t" +RsQuery->FieldByName("ApglBoyAmt")    +
              "\t" +RsQuery->FieldByName("ApglBopAmt")    +
              "\t" +RsQuery->FieldByName("ApglIopAmt")    +
              "\t" +RsQuery->FieldByName("ApglOopAmt")    +
              "\t" +RsQuery->FieldByName("ApglIoyAmt")    +
              "\t" +RsQuery->FieldByName("ApglOoyAmt")    +
              "\t" +RsQuery->FieldByName("ApglAoyAmt")    ;
      sgApgl->AddItem(ItemStr);
      RsQuery->MoveNext();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::tbQueryClick(TObject *Sender)
{
//   if(!ShowQueryWindow())
 //   return;
   try
   {
     StartWaitForm("正在查询,请稍候...");
     FillGridWithData();
   }
   __finally
   {
    EndWaitForm();
   }
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::muFirstClick(TObject *Sender)
{
   if(sgApgl->RowCount > 1)
    sgApgl->Row=1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::muPreviousClick(TObject *Sender)
{
   if( sgApgl->Row>1)
    sgApgl->Row--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::muNextClick(TObject *Sender)
{
   if( sgApgl->Row < sgApgl->RowCount-1)
    sgApgl->Row++;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::muLastClick(TObject *Sender)
{
   if(sgApgl->RowCount > 1)
    sgApgl->Row=sgApgl->RowCount-1;
}
//---------------------------------------------------------------------------

void __fastcall TfrmQu_Apgl::tbRefreshClick(TObject *Sender)
{
  if(m_SQL.IsEmpty())
     return;
  else
     FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apgl::sgApglDblClick(TObject *Sender)
{
     AnsiString Filter;
     if(sgApgl->Row>0 &&sgApgl->Row<sgApgl->RowCount)    //当前行无效
     {
      TfrmQu_Apcl *m_Apcl= new TfrmQu_Apcl(this,g_ClientHandle,"","");
      Filter="ApclFmonth='"+sgApgl->TextMatrix[sgApgl->Row][1]+"'" ;
      RsQuery->MoveFirst();
      RsQuery->LocateByIndex(sgApgl->Row-1);
      Filter+=" and ApclSupply ='"+ RsQuery->FieldByName("ApglSupply")+"'";
      m_Apcl->FilterStr=Filter;
      m_Apcl->FillGridWithData();
      if(m_Apcl->sgApclW->RowCount>1)
      {
        m_Apcl->tbQuery->Visible=false;
        m_Apcl->tbRefresh->Visible=false;
        m_Apcl->tbControl->Visible=false;
        m_Apcl->BorderStyle=bsDialog;
        m_Apcl->ToolButton3->Visible=false;
        m_Apcl->ShowModal();
      }
     }
}
//---------------------------------------------------------------------------

void __fastcall TfrmQu_Apgl::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    TQueryBaseForm::FormClose(Sender,Action);
    RsQuery->Close();
    delete  RsQuery;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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