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

📄 gspquery_amt.cpp

📁 速达开源ERP系统
💻 CPP
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "GspQuery_Amt.h"
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma package(smart_init)
#pragma link "QueryBaseForm"
#pragma link "SDGrid"
#pragma resource "*.dfm"

TfrmGspQuery_Amt *frmGspQuery_Amt;
//---------------------------------------------------------------------------
__fastcall TfrmGspQuery_Amt::TfrmGspQuery_Amt(TComponent* Owner)
   : TQueryBaseForm(Owner)
{
   sgGspQuery->RowCount=3;
   InitGridControl();
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::InitGridControl()
{
   sgGspQuery->Cells[0][0]="产品编码"; sgGspQuery->Cells[0][1]="产品编码";
   sgGspQuery->Cells[1][0]="年度"; sgGspQuery->Cells[1][1]="年度";
   sgGspQuery->Cells[2][0]="一月"; sgGspQuery->Cells[2][1]="计划金额";
   sgGspQuery->Cells[3][0]="一月"; sgGspQuery->Cells[3][1]="完成金额";
   sgGspQuery->Cells[4][0]="二月"; sgGspQuery->Cells[4][1]="计划金额";
   sgGspQuery->Cells[5][0]="二月"; sgGspQuery->Cells[5][1]="完成金额";
   sgGspQuery->Cells[6][0]="三月"; sgGspQuery->Cells[6][1]="计划金额";
   sgGspQuery->Cells[7][0]="三月"; sgGspQuery->Cells[7][1]="完成金额";
   sgGspQuery->Cells[8][0]="四月"; sgGspQuery->Cells[8][1]="计划金额";
   sgGspQuery->Cells[9][0]="四月"; sgGspQuery->Cells[9][1]="完成金额";
   sgGspQuery->Cells[10][0]="五月"; sgGspQuery->Cells[10][1]="计划金额";
   sgGspQuery->Cells[11][0]="五月"; sgGspQuery->Cells[11][1]="完成金额";
   sgGspQuery->Cells[12][0]="六月"; sgGspQuery->Cells[12][1]="计划金额";
   sgGspQuery->Cells[13][0]="六月"; sgGspQuery->Cells[13][1]="完成金额";
   sgGspQuery->Cells[14][0]="七月"; sgGspQuery->Cells[14][1]="计划金额";
   sgGspQuery->Cells[15][0]="七月"; sgGspQuery->Cells[15][1]="完成金额";
   sgGspQuery->Cells[16][0]="八月"; sgGspQuery->Cells[16][1]="计划金额";
   sgGspQuery->Cells[17][0]="八月"; sgGspQuery->Cells[17][1]="完成金额";
   sgGspQuery->Cells[18][0]="九月"; sgGspQuery->Cells[18][1]="计划金额";
   sgGspQuery->Cells[19][0]="九月"; sgGspQuery->Cells[19][1]="完成金额";
   sgGspQuery->Cells[20][0]="十月"; sgGspQuery->Cells[20][1]="计划金额";
   sgGspQuery->Cells[21][0]="十月"; sgGspQuery->Cells[21][1]="完成金额";
   sgGspQuery->Cells[22][0]="十一月"; sgGspQuery->Cells[22][1]="计划金额";
   sgGspQuery->Cells[23][0]="十一月"; sgGspQuery->Cells[23][1]="完成金额";
   sgGspQuery->Cells[24][0]="十二月"; sgGspQuery->Cells[24][1]="计划金额";
   sgGspQuery->Cells[25][0]="十二月"; sgGspQuery->Cells[25][1]="完成金额";
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::tbQueryClick(TObject *Sender)
{
    if(!ShowQueryWindow())
       return;
    try
    {
       StartWaitForm("正在查询,请稍候...");
       FillGridWithData();
    }
    __finally
    {
       EndWaitForm();
    }
}
//---------------------------------------------------------------------------
bool __fastcall TfrmGspQuery_Amt::ShowQueryWindow()
{
    TfrmQuForm *FQuery=new TfrmQuForm(this,this->Name);
    FQuery->ShowModal();
    if(FQuery->CancelQuery)
       return false;
    FilterStr=FQuery->CreateSqlString;
    delete FQuery;
    return true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::ClearControl(bool BringToNext)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::GetDataFromComObject()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::WaitUserInput()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::RefreshGridData(int mAction)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::DisplayBill()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::GetBill(AnsiString BillID)
{
   return;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmGspQuery_Amt::GetQueryStr()
{
    AnsiString Selstr,Fromstr,Wherestr,Orderstr;
    Selstr =" select * ";
    Fromstr=" from SDVW_GspAmt ";
    if(FilterStr!="")
    Wherestr=" where "+ FilterStr;
    Orderstr=" Order by GspGoods,GspYear";
    sSQL=Selstr+Fromstr+Wherestr+Orderstr;
    return(sSQL);
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::FillGridWithData()
{
    AnsiString sSql;
    AnsiString ItemStr;
    TComResultSet *RsQuery;
    sSql=GetQueryStr();
    if(sSql=="")
      return;
    sgGspQuery->RowCount=2;
    RsQuery=NewResultSet();
    RsQuery->Open(WideString(sSql),WideString(""));
    RsQuery->MoveFirst();
    while(RsQuery->Eof == 0)
    {
      ItemStr=RsQuery->FieldByName("GspGoods")+
            "\t"+RsQuery->FieldByName("GspYear")+
            "\t"+RsQuery->FieldByName("PAmt1")+
            "\t"+RsQuery->FieldByName("RAmt1")+
            "\t"+RsQuery->FieldByName("PAmt2")+
            "\t"+RsQuery->FieldByName("RAmt2")+
            "\t"+RsQuery->FieldByName("PAmt3")+
            "\t"+RsQuery->FieldByName("RAmt3")+
            "\t"+RsQuery->FieldByName("PAmt4")+
            "\t"+RsQuery->FieldByName("RAmt4")+
            "\t"+RsQuery->FieldByName("PAmt5")+
            "\t"+RsQuery->FieldByName("RAmt5")+
            "\t"+RsQuery->FieldByName("PAmt6")+
            "\t"+RsQuery->FieldByName("RAmt6")+
            "\t"+RsQuery->FieldByName("PAmt7")+
            "\t"+RsQuery->FieldByName("RAmt7")+
            "\t"+RsQuery->FieldByName("PAmt8")+
            "\t"+RsQuery->FieldByName("RAmt8")+
            "\t"+RsQuery->FieldByName("PAmt9")+
            "\t"+RsQuery->FieldByName("RAmt9")+
            "\t"+RsQuery->FieldByName("PAmt10")+
            "\t"+RsQuery->FieldByName("RAmt10")+
            "\t"+RsQuery->FieldByName("PAmt11")+
            "\t"+RsQuery->FieldByName("RAmt11")+
            "\t"+RsQuery->FieldByName("PAmt12")+
            "\t"+RsQuery->FieldByName("RAmt12");
      sgGspQuery->AddItem(ItemStr);
      RsQuery->MoveNext();
    }
    RsQuery->Close();
    delete RsQuery;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::muFirstClick(TObject *Sender)
{
  if(sgGspQuery->RowCount > 1)
     sgGspQuery->Row=2;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::muPreviousClick(TObject *Sender)
{
  if(sgGspQuery->RowCount > 1 && sgGspQuery->Row > 1)
     sgGspQuery->Row=sgGspQuery->Row-1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::muNextClick(TObject *Sender)
{
  if(sgGspQuery->RowCount > 1 && sgGspQuery->Row < sgGspQuery->RowCount-1)
      sgGspQuery->Row=sgGspQuery->Row+1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::muLastClick(TObject *Sender)
{
  if(sgGspQuery->RowCount > 1)
     sgGspQuery->Row=sgGspQuery->RowCount-1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Amt::tbRefreshClick(TObject *Sender)
{
    if(sSQL=="")
       return;
    FillGridWithData();
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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