qu_apnp.cpp

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

CPP
145
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Qu_Apnp.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "QueryBaseForm"
#pragma link "SDGrid"
#pragma link "KSAdvReport"
#pragma resource "*.dfm"
TfrmQu_Apnp *frmQu_Apnp;
//---------------------------------------------------------------------------
__fastcall TfrmQu_Apnp::TfrmQu_Apnp(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
        : TQueryBaseForm(Owner,chWnd,MidCode,WhereStr)
{
    m_SQL="";      //查询语句
    QueryGrid=sgApnp;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::ClearControl(bool BringToNext)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::GetDataFromComObject()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::WaitUserInput()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::RefreshGridData(int mAction)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::DisplayBill()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::GetBill(AnsiString BillID)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::FillGridWithData()
{
   TComResultSet *RsQuery=new  TComResultSet(Handle,g_ClientHandle);
   AnsiString  ItemStr="",m_FiStr="";
   if(FilterStr=="")
      m_FiStr="";
   else
      m_FiStr=" where "+FilterStr;
   m_SQL=" select * from sdVW_Apnp "+m_FiStr+" order by ApnpCode";
   sgApnp->RowCount=1;
   try
   {
     RsQuery->Open(m_SQL,"");
     RsQuery->MoveFirst();
     while( RsQuery->Eof == 0)
     {
      ItemStr="\t" +RsQuery->FieldByName("ApnpFmonth")    +
              "\t" +RsQuery->FieldByName("ApnpCode")    +
              "\t" +RsQuery->FieldByName("ApnpDate")    +
              "\t" +RsQuery->FieldByName("ApnpCantName")    +
              "\t" +RsQuery->FieldByName("SupplyName")    +
              "\t" +RsQuery->FieldByName("ApnpCurrency")    +
              "\t" +RsQuery->FieldByName("ApnpEnrate")    +
              "\t" +RsQuery->FieldByName("ApnpAmt")    +
              "\t" +RsQuery->FieldByName("ApnpCAmt")    +
              "\t" +RsQuery->FieldByName("ApnpStateName")    +
              "\t" +RsQuery->FieldByName("ApnpUiRate")    +
              "\t" +RsQuery->FieldByName("ApnpEiRate")    +
              "\t" +RsQuery->FieldByName("ApnpSdate")    +
              "\t" +RsQuery->FieldByName("ApnpEdate")    +
              "\t" +RsQuery->FieldByName("ApnpTerm")    +
              "\t" +RsQuery->FieldByName("ApnpUser")    +
              "\t" +(RsQuery->FieldByName("ApnpCheck")==1?"审核":"未审核")+
              "\t" +RsQuery->FieldByName("ApnpChecker")    +
              "\t" +RsQuery->FieldByName("ApnpCheckDate")    +
              "\t" +RsQuery->FieldByName("ApnpSysDate")    +
              "\t" +RsQuery->FieldByName("ApnpDesc")    ;
      sgApnp->AddItem(ItemStr);
      RsQuery->MoveNext();
    }
    RsQuery->Close();
   }
   __finally
   {
     delete RsQuery;
   }
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::tbQueryClick(TObject *Sender)
{
//  if(!ShowQueryWindow())
 //  return;  
  try{ 
    StartWaitForm("正在查询,请稍候...");
    FillGridWithData();
     }
   __finally
   {
    EndWaitForm();
   }
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::tbRefreshClick(TObject *Sender)
{
   if(m_SQL!="")
     FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::muFirstClick(TObject *Sender)
{
   if(sgApnp->RowCount > 1)
    sgApnp->Row=1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::muPreviousClick(TObject *Sender)
{
   if( sgApnp->Row>1)
    sgApnp->Row--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::muNextClick(TObject *Sender)
{
   if( sgApnp->Row < sgApnp->RowCount-1)
    sgApnp->Row++;
}
//---------------------------------------------------------------------------
void __fastcall TfrmQu_Apnp::muLastClick(TObject *Sender)
{
   if(sgApnp->RowCount > 1)
    sgApnp->Row=sgApnp->RowCount-1;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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