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

📄 sogdview.cpp

📁 速达开源ERP系统
💻 CPP
字号:
//---------------------------------------------------------------------------

#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)
        : TListBaseForm(Owner,euSdSogh,"")
{

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

void __fastcall TfrmSogdView::InitEditControl()
{
 FillEdit(scSoghCurrency,"select CurrencyCode,CurrencyName from sdCurrency","CurrencyName","CurrencyCode");
 FillEdit(scSoghClient,"select ClientCode,ClientName from sdClient","ClientName","ClientCode");
 scSoghType->ClearAll();
 scSoghType->AddItems("据订单发货","1");
 scSoghType->AddItems("非订单发货","2");

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

void __fastcall TfrmSogdView::ClearControl()
{
}
//---------------------------------------------------------------------------

void __fastcall TfrmSogdView::GetDataFromComObject(int Section)
{
        if (Section==1)
        {
        seSoghCode->Text       =GetHeadValue(fiSoghCode);
        scSoghClient->LocateKey(GetHeadValue(fiSoghClient));
        scSoghCurrency->LocateKey(GetHeadValue(fiSoghCurrency));
        scSoghType->LocateKey(GetHeadValue(fiSoghType));
        }
        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(fiSogdLine)+"\t"+GetDetailValue(fiSogdSoCode)+"\t"+
                  GetDetailValue(fiSogdSodLine)+"\t"+GetDetailValue(fiSogdGoods)+"\t"+
                  GetDetailValue(fiSogdUnit)+"\t"+GetDetailValue(fiSogdPrice)+"\t"+
                  GetDetailValue(fiSogdQty)+"\t"+GetDetailValue(fiSogdAmt)+"\t"+
                  GetDetailValue(fiSogdTaxAmt)+"\t"+GetDetailValue(fiSogdDAmt)+
                  "\t"+GetDetailValue(fiSogdBQty);
         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);
}
//---------------------------------------------------------------------------

void __fastcall TfrmSogdView::FillGridWithData()
{
      int i;
      sgSogd->RowCount=1;
      for (i=0;i<comServer->ItemCount;i++)
      {
          comServer->LocateItemByIndex(i);
          RefreshGridData(0);
      }
}
//---------------------------------------------------------------------------

AnsiString __fastcall TfrmSogdView::GetHeadValue(int Index)
{
        WideString S;
        S = ReadFieldValue(comServer,Index);
        return S;
}
//---------------------------------------------------------------------------

AnsiString __fastcall TfrmSogdView::GetDetailValue(int Index)
{
        WideString S;
        S = ReadItemValue(comServer,Index);
        return S;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogdView::SetHeadValue(int Index,AnsiString Value)
{
       WriteFieldValue(comServer,Index,WideString(Value));
}

//---------------------------------------------------------------------------

void __fastcall TfrmSogdView::SetDetailValue(int Index,AnsiString Value)
{
       WriteItemValue(comServer,Index,WideString(Value));
}
//---------------------------------------------------------------------------



void __fastcall TfrmSogdView::FormShow(TObject *Sender)
{
       ClearControl();
       GetBill(BillNumID);
       ChangeToBrowseState(true);

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



void __fastcall TfrmSogdView::ChangeToBrowseState(bool Browse)
{

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

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

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


⌨️ 快捷键说明

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