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

📄 sogh_n_o.cpp

📁 速达开源ERP系统
💻 CPP
📖 第 1 页 / 共 3 页
字号:
              "\t"+GetDetailValue(fiSogdTaxAmt)+
              "\t"+GetDetailValue(fiSogdDAmt);
    return(ItemStr);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::RefreshGridData(int mAction)
{
    AnsiString ItemStr;
    ItemStr=GetItemString();
    switch(mAction)
    {
      case 0:
        sgSogd->AddItem(ItemStr);
        break;
      case 1:
        sgSogd->ChangeItem(ItemStr,sgSogd->Row);
        break;
      case 2:
        sgSogd->RemoveItem(sgSogd->Row);
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::DisplayBill()
{
    if(comServer->RecordCount<1)
       return;
    GetDataFromComObject(1);
    ChangeToBrowseState(true);
    FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::GetBill(AnsiString BillID)
{
    if(comServer->Find("SoghCode='"+BillID+"'"))
       DisplayBill();
    else
    {
       if(ShowMessageWindow("在数据库中没有查到记录:"+BillID+",要增加吗?",mwsConfirmation)==IDYES)
          AddHeadRecord();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::FillGridWithData()
{
    int i;
    AnsiString ItemStr;
    sgSogd->RowCount=1;
    for(i=0;i<comServer->ItemCount;i++)
    {
       comServer->LocateItemByIndex(i);
       RefreshGridData(0);
    }
    comServer->LocateItemByIndex(0);
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmSogh_N_O::GetHeadValue(int Index)
{
    WideString S;
    S = ReadFieldValue(comServer,Index);
    return S;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmSogh_N_O::GetDetailValue(int Index)
{
    WideString S;
    S = ReadItemValue(comServer,Index);
    return S;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::SetHeadValue(int Index,AnsiString Value)
{
    WriteFieldValue(comServer,Index,Value);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::SetDetailValue(int Index,AnsiString Value)
{
    WriteItemValue(comServer,Index,Value);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::FormShow(TObject *Sender)
{
    ClearControl(1,false);
    ClearControl(2,false);
    TBillBaseForm::MoveToFirst();
    ChangeToBrowseState(true);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::sgSogdSelectCell(TObject *Sender, int ACol,
      int ARow, bool &CanSelect)
{
    if(ARow == 0)
      return;
    comServer->LocateItemByKey(WideString(sgSogd->TextMatrix[ARow][1]));
    if(!comServer->Eof)
      GetDataFromComObject(2);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::sgSogdDblClick(TObject *Sender)
{
    int iRow;
    iRow=sgSogd->Row;
    if(iRow == 0)
      return;
    ChangeToBrowseState(false);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::ChangeToBrowseState(bool t_browse)
{
    if(t_browse){
      sgSogd->Visible=true;
      FloatPanel2->Visible=false;
      sgSogd->Align=alClient;
      FloatPanel2->Align=alNone;
    }
    else{
      sgSogd->Visible=false;
      FloatPanel2->Visible=true;
      sgSogd->Align=alNone;
      FloatPanel2->Align=alClient;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::btnOKClick(TObject *Sender)
{
    if(CurrentState==caAddDetail || CurrentState==caAddBill)
    {
      try
      {
       if(DetailState==caAddDetail)
         comServer->AddItem();
       SendDataToComObject(2);
       comServer->AddToObject();
       ClearControl(2,false);
      }
     catch(Exception &e)
      {
       throw Exception(e.Message);
      }
    }
    else
       ChangeToBrowseState(false);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::btnCancelClick(TObject *Sender)
{
    CancelChange();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdQtyExit(TObject *Sender)
{
    CalculateAmt();
}
//---------------------------------------------------------------------------
void  __fastcall TfrmSogh_N_O::RefreshUpdateData(int MsgSrc,int MsgType)
{
  AnsiString KeyCode;
  switch(MsgSrc)
  {
    case euSdCurrency:
      if(ShowUpdateMessage(MsgSrc,MsgType))
      {
        KeyCode=seSoghCurrency->ItemData[cbItem2];
        AnsiString sSql;
        sSql =AnsiString("select currencycode,currencyname,currencyrate=coalesce(rateratio,1),currencylocal from sdcurrency,sdrate");
        sSql+=" where currencycode*=ratecurrency and ";
        sSql+=" ratefmonth='"+g_sdSMonth+"'";
        FillEdit(seSoghCurrency,sSql,"CurrencyName","CurrencyCode","CurrencyRate","CurrencyLocal");
        seSoghCurrency->LocateKey(KeyCode);
      }
      break;
    case euSdSsite:
      if(ShowUpdateMessage(MsgSrc,MsgType))
      {
        KeyCode=seSoghSsite->ItemData[cbItem2];
        FillEdit(seSoghSsite,"SELECT SsiteName,SsiteCode FROM sdSsite","SSiteName","SsiteCode");
        seSoghSsite->LocateKey(KeyCode);
      }
      break;
    case euSdSettleMode:
      if(ShowUpdateMessage(MsgSrc,MsgType))
      {
        KeyCode=scSoghSettleMode->ItemData[cbItem2];
        FillComboBox(scSoghSettleMode,"select settlemodename,settlemodecode from sdsettlemode order by settlemodename","settltModeName","SettleModeCode");
        scSoghSettleMode->LocateKey(KeyCode);
      }
      break;
    case euSdTax:
      if(ShowUpdateMessage(MsgSrc,MsgType))
      {
        KeyCode=scSoghTaxCode->ItemData[cbItem2];
        FillComboBox(scSoghTaxCode,"SELECT TaxName,TaxCode,TaxRate FROM sdTax order by TaxCode","TaxName","TaxCode","TaxRate");
        scSoghTaxCode->LocateKey(KeyCode);
      }
      break;
    case euSdPosType:
      if(ShowUpdateMessage(MsgSrc,MsgType))
      {
        KeyCode=scSoghPosType->ItemData[cbItem2];
        FillComboBox(scSoghPosType,"SELECT PosTypeCode,PosTypeName FROM sdPosType where postypeflg=2 order by PosTypeCode","PosTypeName","PosTypeCode");
        scSoghPosType->LocateKey(KeyCode);
      }
      break;
    case euSdDeliver:
      if(ShowUpdateMessage(MsgSrc,MsgType))
      {
        KeyCode=scSoghDeliver->ItemData[cbItem2];
        FillComboBox(scSoghDeliver,"SELECT DeliverName,DeliverCode FROM sdDeliver order by DeliverCode","DeliverName","DeliverCode");
        scSoghDeliver->LocateKey(KeyCode);
      }
      break;
    case euSdTransMode:
          if(ShowUpdateMessage(MsgSrc,MsgType))
           {
            KeyCode=scSoghTransMode->ItemData[cbItem2];
            FillComboBox(scSoghTransMode,"SELECT TransModeName,TransModeCode FROM sdTransMode order by TransModeCode","TransModeName","TransModeCode");
            scSoghTransMode->LocateKey(KeyCode);
           }
          break;
    case euSdClient:
        if(ShowUpdateMessage(MsgSrc,MsgType))
        {
          KeyCode=seSoghClient->ItemData[cbItem2];
          FillEdit(seSoghClient,"SELECT ClientName,ClientCode,ClientCurrency,ClientTaxCode FROM sdClient where ClientCancel=0","ClientName","ClientCode","ClientCurrency","ClientTaxCode");
          seSoghClient->LocateKey(KeyCode);
        }
        break;

        //Sogd
     case euSdUnit:
          if(ShowUpdateMessage(MsgSrc,MsgType))
          {
            KeyCode=seSogdUnit->ItemData[cbItem2];
            FillEdit(seSogdUnit,"SELECT UnitCode,UnitName FROM sdUnit","Unitname","UnitCode");
            seSogdUnit->LocateKey(KeyCode);
            }
          break;
     case euSdLoc:
          if(ShowUpdateMessage(MsgSrc,MsgType))
           {
            KeyCode=seSogdLoc->ItemData[cbItem2];
            FillEdit(seSogdLoc,"select LocCode,LocName from sdLoc where Loctype=1 or loctype=4 order by LocCode","LocName","LocCode");
            seSogdLoc->LocateKey(KeyCode);
            }
          break;
     case euSdBatch:
        if(ShowUpdateMessage(MsgSrc,MsgType))
        {
          KeyCode=seSogdBatch->ItemData[cbItem2];
          FillEdit(seSogdBatch,"SELECT BatchCode,BatchDesc FROM sdBatch ","BatchDesc","BatchCode");
          seSogdBatch->LocateKey(KeyCode);
        }
        break;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSoghCodeKeyDown(TObject *Sender, WORD &Key,
      TShiftState Shift)
{
    if(Key==13 && CurrentState==caNormal)
    {
       comServer->LocateByKey(WideString(seSoghCode->Text));
       DisplayBill();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::SetRelativeState(AnsiString GoodsCode)
{
    int IsFound=g_sdRsGoods->LocateByKey(WideString(Trim(GoodsCode)));
    if(IsFound != 0)
      return;
    seSogdGoods->Text=GetGoodsValue("GoodsCode");
    seSogdGoodsName->Text=GetGoodsValue("GoodsName");
  if(CurrentState!=caNormal)
    {
    seSogdUnit->LocateKey(GetGoodsValue("GoodsUnitCode"));
    seSogdConv->Text="1";
    if(GetGoodsValue("GoodsMUnit")=="0")
    {
      seSogdUnit->Enabled=false;
      seSogdConv->Enabled=false;
    }
    else
    {
      seSogdUnit->Enabled=true;
      seSogdConv->Enabled=true;
    }
    if(GetGoodsValue("GoodsBatch")=="0")
    {
      seSogdBatch->ItemIndex=-1;
      seSogdBatch->Enabled=false;
    }
    else

⌨️ 快捷键说明

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