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

📄 sodview.cpp

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

#include <vcl.h>
#pragma hdrstop

#include "SodView.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"
TfrmSodView *frmSodView;
//---------------------------------------------------------------------------
__fastcall TfrmSodView::TfrmSodView(TComponent* Owner)
        : TListBaseForm(Owner,euSdSoh,"")
{

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

void __fastcall TfrmSodView::InitEditControl()
{
 FillEdit(scSohCurrency,"select CurrencyCode,CurrencyName from sdCurrency","CurrencyName","CurrencyCode");
 FillEdit(scSohClient,"select ClientCode,ClientName from sdClient","ClientName","ClientCode");
}
//---------------------------------------------------------------------------

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

void __fastcall TfrmSodView::GetDataFromComObject(int Section)
{
        if (Section==1)
        {
        seSohCode->Text       =GetHeadValue(fiSohCode);
        scSohClient->LocateKey(GetHeadValue(fiSohClient));
        scSohCurrency->LocateKey(GetHeadValue(fiSohCurrency));
        }
        else
        {
        }
}
//---------------------------------------------------------------------------

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

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

void __fastcall TfrmSodView::RefreshGridData(int mAction)
{

        int i;
        AnsiString ItemStr;
        ItemStr="\t"+GetDetailValue(fiSodLine)+"\t"+GetDetailValue(fiSodGoods)+"\t"+
                    GetDetailValue(fiSodUnit)+"\t"+GetDetailValue(fiSodConv)+"\t"+
                    GetDetailValue(fiSodPrice)+"\t"+GetDetailValue(fiSodQty)+"\t"+
                    AnsiString(GetDetailValue(fiSodAmt).ToDouble()+GetDetailValue(fiSodTaxAmt).ToDouble())+"\t"+
                    GetDetailValue(fiSodSQty)+"\t"+GetDetailValue(fiSodBQty)+"\t"+
                    AnsiString(GetDetailValue(fiSodQty).ToDouble()-GetDetailValue(fiSodSQty).ToDouble()+GetDetailValue(fiSodBQty).ToDouble());
         sgSod->AddItem(ItemStr);
}
//---------------------------------------------------------------------------

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

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

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

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

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

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

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



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

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



void __fastcall TfrmSodView::ChangeToBrowseState(bool Browse)
{

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

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

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



⌨️ 快捷键说明

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