sogdview.cpp

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

CPP
157
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "SogdView.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"
TfrmSogdView *frmSogdView;
//---------------------------------------------------------------------------
__fastcall TfrmSogdView::TfrmSogdView(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
        : TListBaseForm(Owner,chWnd,MidCode,WhereStr)
{
 BillNumID=WhereStr;
}
//---------------------------------------------------------------------------
__fastcall TfrmSogdView::TfrmSogdView(TComponent* Owner)
        : TListBaseForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogdView::InitEditControl()
{
 FillEdit(Query,scSoghCurrency,"select CurrencyCode,CurrencyName from sdCurrency","CurrencyName","CurrencyCode");
 FillEdit(Query,scSoghClient,"select ClientCode,ClientName from sdClient","ClientName","ClientCode");
 scSoghType->ClearAll();
 scSoghType->AddItems("据订单发货","1");
 scSoghType->AddItems("非订单发货","2");

}
//---------------------------------------------------------------------------

void __fastcall TfrmSogdView::ClearControl()
{
 seSoghCode->Text = "";
 scSoghType->Text = "";
 scSoghClient->Text = "";
 scSoghCurrency->Text = "";

}
//---------------------------------------------------------------------------
void __fastcall TfrmSogdView::GetDataFromComObject(int Section)
{
        if (Section==1)
        {
        seSoghCode->Text       =GetHeadValue("SoghCode");
        scSoghClient->LocateKey(GetHeadValue("SoghClient"));
        scSoghCurrency->LocateKey(GetHeadValue("SoghCurrency"));
        scSoghType->LocateKey(GetHeadValue("SoghType"));
        }
        else
        {
        }
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogdView::SendDataToComObject(int Section)
{
}

//---------------------------------------------------------------------------
void __fastcall TfrmSogdView::WaitUserInput(int Section)
{
}

//---------------------------------------------------------------------------
void __fastcall TfrmSogdView::RefreshGridData(int mAction)
{

        int i;
        AnsiString ItemStr;
              ItemStr="\t"+GetDetailValue("SogdLine")+"\t"+GetDetailValue("SogdSoCode")+"\t"+
                  GetDetailValue("SogdSodLine")+"\t"+GetDetailValue("SogdGoods")+"\t"+
                  GetDetailValue("SogdGoodsName")+"\t"+GetDetailValue("SogdGoodsSpec")+"\t"+
                  GetDetailValue("SogdUnit")+"\t"+GetDetailValue("SogdPrice")+"\t"+
                  GetDetailValue("SogdQty")+"\t"+GetDetailValue("SogdAmt")+"\t"+
                  GetDetailValue("SogdTaxAmt")+"\t"+GetDetailValue("SogdDAmt")+
                  "\t"+GetDetailValue("SogdBQty");
         sgSogd->AddItem(ItemStr);
}
//---------------------------------------------------------------------------

void __fastcall TfrmSogdView::DisplayBill()
{
        GetDataFromComObject(1);
        FillGridWithData();
}
//---------------------------------------------------------------------------

void __fastcall TfrmSogdView::GetBill(AnsiString BillID)
{
    comServer->FilterString=WideString("SoghCode='"+BillID+"'");
    comServer->Query();
   if (comServer->RecordCount!=0)      //Found it
   {
         DisplayBill();
   }
   else
   {
        ShowMessageWindow("在数据库中没有查到记录:"+BillID+",请查证",mwsInformation);
        BillID = "";
   }

}
//---------------------------------------------------------------------------

void __fastcall TfrmSogdView::FillGridWithData()
{
      int i;
      sgSogd->RowCount=1;
      for (i=0;i<comServer->ItemCount;i++)
      {
          comServer->LocateItemByIndex(i);
          RefreshGridData(0);
      }
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogdView::FormShow(TObject *Sender)
{
       ClearControl();
       GetBill(BillNumID);
       if ( BillNumID == "" )
           frmSogdView->FormClose(Sender, NULL);
       ChangeToBrowseState(true);

}
//---------------------------------------------------------------------------



void __fastcall TfrmSogdView::ChangeToBrowseState(bool Browse)
{

}
//---------------------------------------------------------------------------

void __fastcall TfrmSogdView::btnOKClick(TObject *Sender)
{
      ChangeToBrowseState(true);
}
//---------------------------------------------------------------------------

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


⌨️ 快捷键说明

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