goodsview.cpp

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

CPP
120
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "GoodsView.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DateEdit"
#pragma link "fpanel"
#pragma link "ListBaseForm"
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmGoodsView *frmGoodsView;
//---------------------------------------------------------------------------
__fastcall TfrmGoodsView::TfrmGoodsView(TComponent* Owner)
        : TListBaseForm(Owner,euSdGoods,"")
{

}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmGoodsView::GetHeadValue(int Index)
{
        WideString S;
        S = ReadFieldValue(comServer,Index);
        return S;
}
void __fastcall TfrmGoodsView::SetHeadValue(int Index ,AnsiString Value)
{
       WriteFieldValue(comServer,Index,WideString(Value));
}
void __fastcall TfrmGoodsView::SetDetailValue(int Index, AnsiString Value)
{
       WriteItemValue(comServer,Index,WideString(Value));
}
AnsiString __fastcall TfrmGoodsView::GetDetailValue(int FieldIndex)
{
        WideString S;
        S = ReadItemValue(comServer,FieldIndex);
        return S;
}
void __fastcall TfrmGoodsView::InitEditControl()
{
}
void __fastcall TfrmGoodsView::ClearControl()
{
}
void __fastcall TfrmGoodsView::GetDataFromComObject(int Section)
{
/*例子  if (Section==1)
        {
        seSohCode->Text       =GetHeadValue(fiSohCode);
        scSohClient->LocateKey(GetHeadValue(fiSohClient));
        scSohCurrency->LocateKey(GetHeadValue(fiSohCurrency));
        }
        else
        {
        } */
}
void __fastcall TfrmGoodsView::FormShow(TObject *Sender)
{
       ClearControl();
       GetBill(BillNumID);
       ChangeToBrowseState(true);

}
//---------------------------------------------------------------------------
void __fastcall TfrmGoodsView::FormClose(TObject *Sender,
      TCloseAction &Action)
{
//...
}
//---------------------------------------------------------------------------

void __fastcall TfrmGoodsView::SendDataToComObject(int Section)
{
}
void __fastcall TfrmGoodsView::WaitUserInput(int Section)
{
}
void __fastcall TfrmGoodsView::RefreshGridData(int mAction)
{
   /*例子 int i;
        AnsiString ItemStr;
        ItemStr="\t"+GetDetailValue(fiSodLine)+"\t"+GetDetailValue(fiSodGoods);
        sgGrid->AddItem(ItemStr); */
}
void __fastcall TfrmGoodsView::DisplayBill()
{
        GetDataFromComObject(1);
        FillGridWithData();
}
void __fastcall TfrmGoodsView::GetBill(AnsiString BillID)
{
    comServer->FilterString=WideString("/*单据号*/='"+BillID+"'");
    comServer->Query();
    if (comServer->RecordCount!=0)      //Found it
       {
         DisplayBill();
       }
       else
        ShowMessageWindow("在数据库中没有查到记录:"+BillID+",请查证",mwsInformation);
}
void __fastcall TfrmGoodsView::FillGridWithData()
{
      int i;
      sgGrid->RowCount=1;
      for (i=0;i<comServer->ItemCount;i++)
      {
          comServer->LocateItemByIndex(i);
          RefreshGridData(0);
      }
}
void __fastcall TfrmGoodsView::ChangeToBrowseState(bool Browse)
{
}

⌨️ 快捷键说明

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