sivodview.cpp

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

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

#include <vcl.h>
#pragma hdrstop

#include "SivodView.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"
TfrmSivodView *frmSivodView;
//---------------------------------------------------------------------------
__fastcall TfrmSivodView::TfrmSivodView(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
        : TListBaseForm(Owner,chWnd,MidCode,WhereStr)
{
 BillNumID=WhereStr;
}
__fastcall TfrmSivodView::TfrmSivodView(TComponent* Owner)
        : TListBaseForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TfrmSivodView::InitEditControl()
{
 FillEdit(Query,scSivohCurrency,"select CurrencyCode,CurrencyName from sdCurrency","CurrencyName","CurrencyCode");
 FillEdit(Query,scSivohClient,"select ClientCode,ClientName from sdClient order by ClientCode","ClientName","ClientCode");
 scSivohType->ClearAll();
 scSivohType->AddItems("普通发票","1");
 scSivohType->AddItems("一般增值发票","2");
 scSivohType->AddItems("大额增值发票","3");

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

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

void __fastcall TfrmSivodView::GetDataFromComObject(int Section)
{
//        if (Section==1)
//        {
        seSivohCode->Text       =GetHeadValue("SivohCode");
        scSivohClient->LocateKey(GetHeadValue("SivohClient"));
        scSivohCurrency->LocateKey(GetHeadValue("SivohCurrency"));
        scSivohType->LocateKey(GetHeadValue("SivohType"));
//        }
//        else
//        {
//        }
}
//---------------------------------------------------------------------------

void __fastcall TfrmSivodView::SendDataToComObject(int Section)
{
}
//---------------------------------------------------------------------------

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

void __fastcall TfrmSivodView::RefreshGridData(int mAction)
{
             AnsiString ItemStr;
             ItemStr="\t"+GetDetailValue("SivodLine")+"\t"+GetDetailValue("SivodSogCode")+"\t"+
                    GetDetailValue("SivodGoods")+"\t"+GetDetailValue("SivodUnit")+"\t"+
                    GetDetailValue("SivodQty")+"\t"+GetDetailValue("SivodPrice")+"\t"+
                    GetDetailValue("SivodTaxPrice")+"\t"+GetDetailValue("SivodAmt")+"\t"+
                    GetDetailValue("SivodTaxAmt")+"\t"+GetDetailValue("SivodZkAmt")+"\t"+
                    GetDetailValue("SivodSumAmt");
              sgSivod->AddItem(ItemStr);
}
//---------------------------------------------------------------------------

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

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

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

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

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

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

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



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

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



void __fastcall TfrmSivodView::ChangeToBrowseState(bool Browse)
{

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

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

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

⌨️ 快捷键说明

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