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

📄 apcl.cpp

📁 一个以前收集的基于C/S架构的ERP客户端源代码
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Apcl.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "RecBaseForm"
#pragma link "DateEdit"
#pragma link "fpanel"
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmApcl *frmApcl;
//---------------------------------------------------------------------------
__fastcall TfrmApcl::TfrmApcl(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
        : TRecBaseForm(Owner,chWnd,MidCode,WhereStr)
{
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::ClearControl(bool BringToNext)
{
    if(!BringToNext)
    {
      scApclFmonth->Text =g_sdFMonth;  //月份
      scApclSupply->ItemIndex =-1;  //供应商
      scApclCurrency->ItemIndex =-1;  //币种
      seApclBoyAmt->Text   ="";  //年初数
      seApclBopAmt->Text   ="";  //期初数
      seApclIoyAmt->Text   ="";  //本年发生数
      seApclOoyAmt->Text   ="";  //本年付款数
      chkApclInit->Checked =true;  //初始化标志
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::InitEditControl()
{
       ClientGroup->AddComponent(2,false,false,true, FloatPanel1,FloatPanel1->Name);
       ClientGroup->AddComponent(2,true,false,false, FloatPanel2,FloatPanel2->Name);
       ClientGroup->AddComponent(2,true,true,false, sgApcl,sgApcl->Name);
       ClientGroup->AddComponent(2,true,true,true,chkApclInit,chkApclInit->Name);
       FillComboBox(Handle,scApclFmonth,"SELECT Fcmonth FROM sdFc","Fcmonth");

       FillComboBox(Handle,scApclSupply,"SELECT SupplyCode,SupplyName FROM sdSupply  where supplycancel=0  order by SupplyCode","SupplyName","SupplyCode");
       FillComboBox(Handle,scApclCurrency,"SELECT CurrencyCode,currencyName FROM sdcurrency  order by currencyCode","currencyName","currencyCode");
}
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::GetDataFromComObject()
{
      scApclSupply->LocateKey(GetFieldValue("ApclSupply"));
      scApclSupply->Text  = scApclSupply->ItemData[0];
      sgApcl->LocateGrid(1,GetFieldValue("ApclSupply"));
      scApclCurrency->LocateKey(GetFieldValue("ApclCurrency"));
      scApclCurrency->Text  = scApclCurrency->ItemData[0];
      seApclBoyAmt->Text   =GetFieldValue("ApclBoyAmt");
      seApclBopAmt->Text   =GetFieldValue("ApclBopAmt");
      seApclIoyAmt->Text   =GetFieldValue("ApclIoyAmt");
      seApclOoyAmt->Text   =GetFieldValue("ApclOoyAmt");
      chkApclInit->Checked =(GetFieldValue("ApclInit")=="1"?true:false);
}
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::SendDataToComObject()
{

      SetFieldValue("ApclFmonth",scApclFmonth->Text);
      SetFieldValue("ApclSupply",scApclSupply->ItemData[1]);
      SetFieldValue("ApclCurrency",scApclCurrency->ItemData[1]);
      SetFieldValue("ApclBoyAmt",seApclBoyAmt->Text);
      SetFieldValue("ApclBopAmt",seApclBopAmt->Text);
      SetFieldValue("ApclIoyAmt",seApclIoyAmt->Text);
      SetFieldValue("ApclOoyAmt",seApclOoyAmt->Text);
      SetFieldValue("ApclInit",(chkApclInit->Checked==true?"1":"0"));
}
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::WaitUserInput()
{
     scApclSupply->SetFocus();
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmApcl::GetDataToGrid()
{
      AnsiString  s;
      scApclSupply->LocateKey(GetFieldValue("ApclSupply"));
      s = "\t" + scApclSupply->ItemData[0]      +
          "\t" + GetFieldValue("ApclBoyAmt")    +
          "\t" + GetFieldValue("ApclBopAmt")    +
          "\t" + (GetFieldValue("ApclInit")=="1"?"是":"否");
      return s;
}
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::RefreshGridData(int mAction)
{
      AnsiString ItemStr;
      ItemStr = GetDataToGrid();
      if (mAction ==  0)   //Add
      {
          sgApcl->AddItem(ItemStr);
      }
      else if(mAction ==  1)   //Modify
      {
          int i   =   sgApcl->Row;
          sgApcl->ChangeItem(ItemStr,i);
      }
      else if(mAction ==  2)      //Delete
      {
          sgApcl->RemoveItem(sgApcl->Row);
      }
}
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::FillGridWithData()
{
      AnsiString ItemStr;
      comServer->MoveFirst();
      sgApcl->RowCount    =   1;
      while (comServer->Eof   ==  0)
      {
         ItemStr =  GetDataToGrid();
         sgApcl->AddItem(ItemStr);
         comServer->MoveNext();
      }
     comServer->MoveFirst();
}
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::FormShow(TObject *Sender)
{
      scApclFmonth->Text=g_sdFMonth;
      comServer->FilterString = " ApclFmonth = '" + g_sdFMonth + "'";
      comServer->Query();
      FillGridWithData();
      comServer->MoveFirst();
      GetDataFromComObject();
}
//---------------------------------------------------------------------------

void __fastcall TfrmApcl::scApclFmonthClick(TObject *Sender)
{
      comServer->FilterString = " ApclFmonth = '" + scApclFmonth->Text + "'";
      comServer->Query();
      FillGridWithData();
      comServer->MoveFirst();
      GetDataFromComObject();
}
//---------------------------------------------------------------------------
void __fastcall TfrmApcl::sgApclClick(TObject *Sender)
{
   if (sgApcl->Row > 0)
       comServer->LocateByIndex(sgApcl->Row-1);
   if (!comServer->Eof)
      GetDataFromComObject();
}
//---------------------------------------------------------------------------



void __fastcall TfrmApcl::SupplyCodeButtonButtonClick(TObject *Sender)
{
if(OpenSupplyForm("")==true)
    {
     scApclSupply->LocateKey(GetSupplyValue(gtOpenForm,"SupplyCode"));
    }
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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