glbqtyneedrev.cpp
来自「科思ERP部分源码及控件」· C++ 代码 · 共 261 行
CPP
261 行
//---------------------------------------------------------------------------
#include <vcl.h>
#include "GlbQtyNeedRev.h"
#include "GlbmQtyNeedRev.h"
#include "GlbQF_NeedGet.h"
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma package(smart_init)
#pragma link "QueryBaseForm"
#pragma link "SDGrid"
#pragma link "KSAdvReport"
#pragma resource "*.dfm"
TfrmGlbQtyNeedRev *frmGlbQtyNeedRev;
TfrmGlbmQtyNeedRev *TmpGlbmQtyNeedRev;
TfrmGlbQF_NeedGet *TmpGlbQF_NeedGet;
//---------------------------------------------------------------------------
__fastcall TfrmGlbQtyNeedRev::TfrmGlbQtyNeedRev(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
: TQueryBaseForm(Owner,chWnd,MidCode,WhereStr)
{
//InitGridControl();
labMemory->Caption="";
QueryGrid=sgGlbQtyNeedRev;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::InitGridControl()
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::tbQueryClick(TObject *Sender)
{
if(!ShowQueryWindow())
return;
try{
StartWaitForm("正在查询,请稍候...");
labMemory->Caption="--"+FGfcmonthInfo;
FillGridWithData();
}
__finally
{
EndWaitForm();
}
}
//---------------------------------------------------------------------------
bool __fastcall TfrmGlbQtyNeedRev::ShowQueryWindow()
{
TmpGlbQF_NeedGet=new TfrmGlbQF_NeedGet(this);
TmpGlbQF_NeedGet->Caption="应付帐款总帐查询过滤";
TmpGlbQF_NeedGet->FQtyAmtSign="1";
TmpGlbQF_NeedGet->ShowModal();
if(TmpGlbQF_NeedGet->CancelQuery)
{
delete TmpGlbQF_NeedGet;
return false;
}
FilterStr=TmpGlbQF_NeedGet->CreateSqlString;
FGfcmonthInfo=TmpGlbQF_NeedGet->FmonthInfo;
delete TmpGlbQF_NeedGet;
return true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::ClearControl(bool BringToNext)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::GetDataFromComObject()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::WaitUserInput()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::RefreshGridData(int mAction)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::DisplayBill()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::GetBill(AnsiString BillID)
{
return;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmGlbQtyNeedRev::GetHeadQueryStr()
{
AnsiString Selectstr,Fromstr,Wherestr,Orderstr;
//客户编码,客户名称,财务月份,摘要,方向,
Selectstr="select PzdClient,ClientName,PzhFmonth,NoteBookText=IsNULL(NoteBookText,''),PzdDir,KmName = IsNULL(GlkmName,'')";
Selectstr += ",GlbBopAmt,GlbDopAmt,GlbCopAmt,GlbDoyAmt,GlbCoyAmt,GlbAoyAmt";
Fromstr = " From sdPzd,sdPzh,sdClient,sdNoteBook,sdGlkm,sdGlb";
Wherestr = " where PzdClient=IsNULL(ClientCode,'') and PzhCode=PzdCode and PzdZy*=NoteBookCode and PzdGlkm*=GlkmCode and PzhCheck=1";
Wherestr += " and pzdGlkm like '203%'" ;
Wherestr += " and pzhFmonth=GlbFmonth and pzdGlkm=Glbglkm";
if(FilterStr.Trim() != "")
Wherestr += " and " + FilterStr;
Orderstr = " order by PzdClient,PzhFmonth";
sSQL = Selectstr + Fromstr + Wherestr + Orderstr;
return(sSQL);
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmGlbQtyNeedRev::GetSpace(int iNum)
{
AnsiString strSpace;
for(int i=1;i<iNum;i++)
strSpace=strSpace+AnsiString(" ");
return strSpace;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::FillGridWithData()
{
TComResultSet *RsQuery;
AnsiString ItemStr0,ItemStr1,ItemStr2,sSql;
sSql=GetHeadQueryStr(); //取Head查询的SQL语句
if(sSql=="")
return;
sgGlbQtyNeedRev->RowCount=1;
RecentBillCode="";
RsQuery=new TComResultSet(Handle,g_ClientHandle);
RsQuery->Open(sSql,"");
RsQuery->MoveFirst();
ItemStr0 = "";
ItemStr1 = "";
ItemStr2 = "";
while(RsQuery->Eof == 0)
{
double pAmtsum = RsQuery->FieldByName("GlbDopAmt").ToDouble() - RsQuery->FieldByName("GlbCopAmt").ToDouble(); //本期余额
double yAmtsum = RsQuery->FieldByName("GlbAoyAmt").ToDouble(); //本年累计
//期初
ItemStr0 = RsQuery->FieldByName("pzdClient") + "\t" +
RsQuery->FieldByName("ClientName") + "\t" +
RsQuery->FieldByName("PzhFmonth") + "\t" +
"期初余额\t\t\t" ;
if(RsQuery->FieldByName("GlbBopAmt")==0)
ItemStr0 += "平\t0.00" ;
else
ItemStr0 += (RsQuery->FieldByName("PzdDir")=="1" ? "借":"贷") ;
ItemStr0 += "\t" + FormatFloat("#,##0.00",RsQuery->FieldByName("GlbBopAmt").ToDouble());
//本期 --------------------------------------------------------------------------
ItemStr1 = "\t\t" +
RsQuery->FieldByName("PzhFmonth") + "\t" +
"本期合计\t" +
FormatFloat("#,##0.00",RsQuery->FieldByName("GlbDopAmt").ToDouble()) + "\t" +
FormatFloat("#,##0.00",RsQuery->FieldByName("GlbCopAmt").ToDouble()) + "\t" ;
if(pAmtsum == 0)
ItemStr1 += "平\t0.00" ;
else
ItemStr1 += (RsQuery->FieldByName("PzdDir")=="1" ? "借":"贷") ;
ItemStr1 += "\t" + FormatFloat("#,##0.00",pAmtsum) ;
//本年---------------------------------------------------------------------------
ItemStr2 = "\t\t" +
RsQuery->FieldByName("PzhFmonth") + "\t" +
"本年合计\t" +
FormatFloat("#,##0.00",RsQuery->FieldByName("GlbDoyAmt").ToDouble()) + "\t" +
FormatFloat("#,##0.00",RsQuery->FieldByName("GlbCoyAmt").ToDouble()) + "\t" ;
if(yAmtsum == 0)
ItemStr2 += "平\t0.00" ;
else
ItemStr2 += (RsQuery->FieldByName("PzdDir")=="1" ? "借":"贷") ;
ItemStr2 += "\t" + FormatFloat("#,##0.00",yAmtsum) ;
sgGlbQtyNeedRev->AddItem(ItemStr0);
sgGlbQtyNeedRev->AddItem(ItemStr1);
sgGlbQtyNeedRev->AddItem(ItemStr2);
RsQuery->MoveNext();
}
RsQuery->Close();
delete RsQuery;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::muFirstClick(TObject *Sender)
{
if(sgGlbQtyNeedRev->RowCount > 1)
sgGlbQtyNeedRev->Row=1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::muNextClick(TObject *Sender)
{
if(sgGlbQtyNeedRev->RowCount > 1 && sgGlbQtyNeedRev->Row < sgGlbQtyNeedRev->RowCount-1)
sgGlbQtyNeedRev->Row=sgGlbQtyNeedRev->Row+1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::muLastClick(TObject *Sender)
{
if(sgGlbQtyNeedRev->RowCount > 1)
sgGlbQtyNeedRev->Row=sgGlbQtyNeedRev->RowCount-1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::muPreviousClick(TObject *Sender)
{
if(sgGlbQtyNeedRev->RowCount > 1 && sgGlbQtyNeedRev->Row > 1)
sgGlbQtyNeedRev->Row=sgGlbQtyNeedRev->Row-1;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::tbRefreshClick(TObject *Sender)
{
if(sSQL=="")
return;
FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::FormShow(TObject *Sender)
{
tbQueryClick(this);
}
//---------------------------------------------------------------------------
void __fastcall TfrmGlbQtyNeedRev::sgGlbQtyNeedRevDblClick(TObject *Sender)
{
int iRow;
iRow=sgGlbQtyNeedRev->Row;
if(iRow > 1)
if(sgGlbQtyNeedRev->Cells[2][iRow].Trim()!="")
{
try
{
TmpGlbmQtyNeedRev=new TfrmGlbmQtyNeedRev(this);
//TmpGlbmQtyNeedRev->FQtyAmtGlkm=Trim(sgGlbQtyNeedRev->Cells[0][iRow]);
TmpGlbmQtyNeedRev->FQtyAmtFmonth=Trim(sgGlbQtyNeedRev->Cells[2][iRow]);
TmpGlbmQtyNeedRev->FMfcmonthInfo=FGfcmonthInfo;
TmpGlbmQtyNeedRev->FGlbQtyAmtSign=1;
TmpGlbmQtyNeedRev->ShowModal();
}
__finally
{
delete TmpGlbmQtyNeedRev;
}
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?