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

📄 sivodview.cpp

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

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

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

void __fastcall TfrmSivodView::InitEditControl()
{
 FillEdit(scSivohCurrency,"select CurrencyCode,CurrencyName from sdCurrency","CurrencyName","CurrencyCode");
 FillEdit(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(fiSivohCode);
        scSivohClient->LocateKey(GetHeadValue(fiSivohClient));
        scSivohCurrency->LocateKey(GetHeadValue(fiSivohCurrency));
        scSivohType->LocateKey(GetHeadValue(fiSivohType));
        }
        else
        {
        }
}
//---------------------------------------------------------------------------

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

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

void __fastcall TfrmSivodView::RefreshGridData(int mAction)
{
             AnsiString ItemStr;
             ItemStr="\t"+GetDetailValue(fiSivodLine)+"\t"+GetDetailValue(fiSivodSogCode)+"\t"+
                    GetDetailValue(fiSivodGoods)+"\t"+GetDetailValue(fiSivodUnit)+"\t"+
                    GetDetailValue(fiSivodQty)+"\t"+GetDetailValue(fiSivodPrice)+"\t"+
                    GetDetailValue(fiSivodTaxPrice)+"\t"+GetDetailValue(fiSivodAmt)+"\t"+
                    GetDetailValue(fiSivodTaxAmt)+"\t"+GetDetailValue(fiSivodZkAmt)+"\t"+
                    GetDetailValue(fiSivodSumAmt);
              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);
      }
}
//---------------------------------------------------------------------------

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

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

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

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



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)
{
//...
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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