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

📄 ulh.cpp

📁 速达开源ERP系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
void __fastcall TfrmUlh::SetDetailValue(int Index,AnsiString Value)
{
      WriteItemValue(comServer,Index,Value);

}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::FormShow(TObject *Sender)
{
    ClearControl(1,false);
    ClearControl(2,false);
    ChangeToBrowseState();
    TGenBaseForm::MoveToFirst();
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::ChangeToBrowseState(bool Browse)
{
        sgUlh->Visible = true;
        FloatPanel2->Visible = false;
        if(Browse == false)
         sgUlh->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::btnOKClick(TObject *Sender)
{
  try
  {
    if (CurrentState==caAddDetail||CurrentState==caAddBill)
    {
      if(DetailState==caAddDetail)
        comServer->AddItem();
      SendDataToComObject(2);
      comServer->AddToObject();
      ClearControl(2,false);
      if(seUldPoCode->Enabled)
        seUldPoCode->SetFocus();
    }
    else
      ChangeToBrowseState();
  }
  catch(Exception &e)
  {
   throw Exception(e.Message);
  }
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::btnCancelClick(TObject *Sender)
{
    CancelChange();
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::WaitUserInput(int Section)
{
    if (Section ==1)
    { // Head
        if (CurrentState == caEditHead)
          deUlhDate->SetFocus();
        else
        {
          if(seUlhCode->Enabled)
            seUlhCode->SetFocus();
        }
    }
    else
    { // Detail
        sgUlh->Visible=false;
        FloatPanel2->Visible=true;
        if(seUldPoCode->Enabled)
          seUldPoCode->SetFocus();
    } // if
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::sgUlhSelectCell(TObject *Sender, int ACol,
      int ARow, bool &CanSelect)
{
    if (ARow > 0)
    {
       comServer->LocateItemByKey(WideString(sgUlh->TextMatrix[ARow][1]));
    }
    if (!comServer->Eof)
    {
       GetDataFromComObject(2);
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::sgUlhDblClick(TObject *Sender)
{
    int iRow;
    iRow=sgUlh->Row;
    if (iRow == 0)
    {
       return;
    }
    sgUlh->Visible=false;
    FloatPanel2->Visible=true;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmUlh::GetDataToGrid()
{
    AnsiString ItemStr;

    ItemStr="\t"+GetDetailValue(fiUldLine);              //收货单行号
    ItemStr=ItemStr+"\t"+GetDetailValue(fiUldPoCode);    //采购单号
    ItemStr=ItemStr+"\t"+GetDetailValue(fiUldPodLine);   //采购单行号
    ItemStr=ItemStr+"\t"+GetDetailValue(fiUldGoods);     //物料编码
    ItemStr=ItemStr+"\t"+GetDetailValue(fiUldUnit);      //计量单位
    ItemStr=ItemStr+"\t"+GetDetailValue(fiUldPoQty);     //采购数量
    ItemStr=ItemStr+"\t"+GetDetailValue(fiUldUrQty);
    ItemStr=ItemStr+"\t"+GetDetailValue(fiUldRecDate);
    ItemStr=ItemStr+"\t"+GetDetailValue(fiUldDelay);
    return ItemStr;
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::GenrateBill()
{
    int TempCount;
    TempCount = comServer->ItemCount;
    TfrmUld *p;
    p = new TfrmUld(this);
    p->GetComObject(comServer);
    try
    {
     p->ShowModal();
    }
    __finally
    {
     delete p;
    }
    if (TempCount < comServer->ItemCount)
      TGenBaseForm::SaveRecord();
    else
      CancelChange();
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::RefreshUpdateData(int MsgSrc,int MsgType)
{
  switch(MsgSrc)
  {
   case euSdSupply,euSdPoh:
    if(ShowUpdateMessage(MsgSrc,MsgType))
    {
     AnsiString sSQL;
     sSQL=" select supplyname,supplycode ";
     sSQL=sSQL+" from sdsupply ";
     sSQL=sSQL+"  where supplycancel=0 order by supplycode ";
     FillComboBox(scUlhSupply,sSQL,"supplyname","SupplyCode");
    }
    break;
   case euSdPsite:
    FillEdit(seUldPsite,"select PsiteName,PsiteCode from sdPsite ","PsiteName","PsiteCode");
    break;
   case euSdUnit:
    FillEdit(seUldUnit,"select UnitCode,UnitName from sdUnit " "UnitName","UnitCode");
    break;
   default:
    break;
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmUlh::seUldPoCodeButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="010[采购单号][行号][物料编码][计量单位][采购数量][欠货数量][交货日期][发货日期][交货地址][拖期天数]";
  SqlStr+="select podcode,podline,podgoods,podunit,PodQty,PodUrQty=PodQty-PodRQty+PodBQty,PodRecDate,PodSendDate,pohpsite,poddelay=datediff(day,podrecdate,getdate()) from sdpod,sdpoh where podcode=pohcode and pohcheck=1 and ";
  SqlStr+=" podclose=0 and pohclose=0 and pohsupply='"+scUlhSupply->ItemData[cbItem2]+"' and podrecdate<='"+g_sdCurDate+"' order by pohdate desc";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"采购单查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    seUldPoCode->Text=p->ColData[1];
    seUldPodLine->Text=p->ColData[2];
    seUldGoods->Text=p->ColData[3];
    seUldUnit->LocateKey(p->ColData[4]);
    seUldPoQty->Text=p->ColData[5];
    if(g_sdRsGoods->LocateByKey(WideString(seUldGoods->Text))==0)
      seUldGoodsName->Text=GetGoodsValue("GoodsName");
    seUldUrQty->Text=p->ColData[6];
    deUldRecDate->Text=p->ColData[7];
    deUldSendDate->Text=p->ColData[8];
    seUldPsite->LocateKey(p->ColData[9]);
    seUldDelay->Text=p->ColData[10];
  }
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmUlh::seUldUrQtyButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="008[采购单号][行号][物料编码][计量单位][采购数量][收货数量][退货数量][欠货数量]";
  SqlStr+="select podcode,podline,podgoods,podunit,PodQty,PodRqty,PodBQty,PodUrQty=PodQty-PodRQty+PodBQty from sdpod where ";
  SqlStr+=" podclose=0 and podcode='"+seUldPoCode->Text+"' and podline="+seUldPodLine->Text;
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"采购单查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  p->ShowModal();
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmUlh::seUlhCodeExit(TObject *Sender)
{
    if(CurrentState==caNormal && seUlhCode->Text != GetHeadValue(fiUlhCode))
    {
      comServer->LocateByKey(WideString(seUlhCode->Text));
      DisplayBill();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmUlh::UnDoChange()
{
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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