gspquery_qty.cpp

来自「科思ERP部分源码及控件」· C++ 代码 · 共 203 行

CPP
203
字号
//---------------------------------------------------------------------------
#include <vcl.h>
#include "GspQuery_Qty.h"
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma package(smart_init)
#pragma link "QueryBaseForm"
#pragma link "SDGrid"
#pragma link "KSAdvReport"
#pragma resource "*.dfm"

TfrmGspQuery_Qty *frmGspQuery_Qty;
//---------------------------------------------------------------------------
__fastcall TfrmGspQuery_Qty::TfrmGspQuery_Qty(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
   : TQueryBaseForm(Owner,chWnd,MidCode,WhereStr)
{
   sgGspQuery->RowCount=3;
   InitGridControl();
   QueryGrid=sgGspQuery;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::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]="计划数";
	  sgGspQuery->Cells[26][0]="十二月";	sgGspQuery->Cells[26][1]="完成数";

}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::tbQueryClick(TObject *Sender)
{
    if(!ShowQueryWindow())
       return;
    try
    {
       StartWaitForm("正在查询,请稍候...");
       FillGridWithData();
    }
    __finally
    {
       EndWaitForm();
    }
}
//---------------------------------------------------------------------------
bool __fastcall TfrmGspQuery_Qty::ShowQueryWindow()
{
 /*   TfrmQuForm *FQuery=new TfrmQuForm(this,this->Name);
    FQuery->ShowModal();
    if(FQuery->CancelQuery)
       return false;
    FilterStr=FQuery->CreateSqlString;
    delete FQuery;
    return true;*/
    return true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::ClearControl(bool BringToNext)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::GetDataFromComObject()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::WaitUserInput()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::RefreshGridData(int mAction)
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::DisplayBill()
{
   return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::GetBill(AnsiString BillID)
{
   return;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmGspQuery_Qty::GetQueryStr()
{
    AnsiString Selstr,Fromstr,Wherestr,Orderstr;
    Selstr =" select * ";
    Fromstr=" from SDVW_GspQty ";
    if(FilterStr!="")
    Wherestr=" where "+ FilterStr;
    Orderstr=" Order by GspGoods,GspYear";
    sSQL=Selstr+Fromstr+Wherestr+Orderstr;
    return(sSQL);
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::FillGridWithData()
{
    AnsiString sSql;
    AnsiString ItemStr;
    TComResultSet *RsQuery;
    sSql=GetQueryStr();
    if(sSql=="")
      return;
    sgGspQuery->RowCount=2;
    RsQuery=new  TComResultSet(Handle,g_ClientHandle);
    RsQuery->Open(WideString(sSql),WideString(""));
    RsQuery->MoveFirst();
    while(RsQuery->Eof == 0)
    {
	  ItemStr=RsQuery->FieldByName("GspGoods")+
			"\t"+RsQuery->FieldByName("GspGoodsName")+
			"\t"+RsQuery->FieldByName("GspYear")+
            "\t"+RsQuery->FieldByName("PQty1")+
            "\t"+RsQuery->FieldByName("RQty1")+
            "\t"+RsQuery->FieldByName("PQty2")+
            "\t"+RsQuery->FieldByName("RQty2")+
            "\t"+RsQuery->FieldByName("PQty3")+
            "\t"+RsQuery->FieldByName("RQty3")+
            "\t"+RsQuery->FieldByName("PQty4")+
            "\t"+RsQuery->FieldByName("RQty4")+
            "\t"+RsQuery->FieldByName("PQty5")+
            "\t"+RsQuery->FieldByName("RQty5")+
            "\t"+RsQuery->FieldByName("PQty6")+
            "\t"+RsQuery->FieldByName("RQty6")+
            "\t"+RsQuery->FieldByName("PQty7")+
            "\t"+RsQuery->FieldByName("RQty7")+
            "\t"+RsQuery->FieldByName("PQty8")+
            "\t"+RsQuery->FieldByName("RQty8")+
            "\t"+RsQuery->FieldByName("PQty9")+
            "\t"+RsQuery->FieldByName("RQty9")+
            "\t"+RsQuery->FieldByName("PQty10")+
            "\t"+RsQuery->FieldByName("RQty10")+
            "\t"+RsQuery->FieldByName("PQty11")+
            "\t"+RsQuery->FieldByName("RQty11")+
            "\t"+RsQuery->FieldByName("PQty12")+
            "\t"+RsQuery->FieldByName("RQty12");
      sgGspQuery->AddItem(ItemStr);
      RsQuery->MoveNext();
    }
    RsQuery->Close();
    delete RsQuery;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::muFirstClick(TObject *Sender)
{
  if(sgGspQuery->RowCount > 1)
     sgGspQuery->Row=2;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::muPreviousClick(TObject *Sender)
{
  if(sgGspQuery->RowCount > 1 && sgGspQuery->Row > 1)
     sgGspQuery->Row=sgGspQuery->Row-1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::muNextClick(TObject *Sender)
{
  if(sgGspQuery->RowCount > 1 && sgGspQuery->Row < sgGspQuery->RowCount-1)
      sgGspQuery->Row=sgGspQuery->Row+1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::muLastClick(TObject *Sender)
{
  if(sgGspQuery->RowCount > 1)
     sgGspQuery->Row=sgGspQuery->RowCount-1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGspQuery_Qty::tbRefreshClick(TObject *Sender)
{
    if(sSQL=="")
       return;
    FillGridWithData();
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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