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

📄 prech_p_i.cpp

📁 速达开源ERP系统
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    {
     FillComboBox(scPrecdUnit,"SELECT UnitName memo,UnitCode,UnitRate FROM sdUnit Order by UnitCode","Memo","UnitCode","UnitRate");
    }
    break;
   case euSdLoc:
    if(ShowUpdateMessage(MsgSrc,MsgType))
    {
      if(g_sdQuality == false) //无需质量管理
        FillEdit(sePrecdLoc,"select LocCode,LocName from sdLoc where LocType=1 order by locCode","LocName","LocCode");
      else                    //需要质量管理
        FillEdit(sePrecdLoc,"select LocCode,LocName from sdLoc where LocType=3 order by loccode","LocName","LocCode");
    }
    break;
   case euSdBatch:
    if(ShowUpdateMessage(MsgSrc,MsgType))
    {
     FillComboBox(scPrecdBatch,"SELECT BatchCode,BatchDesc FROM sdBatch order by BatchCode","BatchDesc","BatchCode");
    }
    break;
   default:
    break;
  }
}
//---------------------------------------------------------------------------




void __fastcall TfrmPrech_P_I::sePrecdPoButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="008[采购单][行号][物料编码][计量单位][换算系数][采购数量][已收数][单价]";
  SqlStr+="select podcode,podline,podgoods,podunit,PodConvRate,podqty,podrqty,podprice from sdpod,sdpoh where podcode=pohcode and pohcheck=1 and pohclose=0 and ";
  SqlStr+="pohsupply='"+scPrechSupply->ItemData[cbItem2]+"' and pohcurrency='"+sePrechCurrency->ItemData[cbItem2]+"' order by pohdate desc";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"订单查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    sePrecdPo->Text=p->ColData[1];
    sePrecdPodLine->Text=p->ColData[2];
    sePrecdGoods->Text=p->ColData[3];
    scPrecdUnit->LocateKey(p->ColData[4]);
    sePrecdConv->Text=p->ColData[5];
    if(g_sdRsGoods->LocateByKey(WideString(sePrecdGoods->Text))==0)
    {
      sePrecdGoodsName->Text=GetGoodsValue("GoodsName");
      if(GetGoodsValue("GoodsTrackSo")=="0")
      {//该物料不跟踪订单,则锁定销售单号和行号
        sePrecdSo->Enabled=false;
        sePrecdSodLine->Enabled=false;
        sePrecdSo->Text="";
        sePrecdSodLine->Text="0";
      }
      else
      {
        sePrecdSo->Enabled=true;
        sePrecdSodLine->Enabled=true;
      }
      if(GetGoodsValue("GoodsBatch")=="0")
      {//该物料不采用批次管理,则锁定批号
        scPrecdBatch->Enabled=false;
        scPrecdBatch->ItemIndex=-1;
      }
      else
      {
        scPrecdBatch->Enabled=true;
      }
    }
  }
  delete p;

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

void __fastcall TfrmPrech_P_I::sePrecdQtyButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="005[物料编码][计量单位][采购数量][单价][尚欠数量]";
  SqlStr+="select podgoods,podunit,podqty,podprice,podQty=PodQty-PodRQty+PodBQty from sdpod where ";
  SqlStr+="podcode='"+sePrecdPo->Text+"' and podline="+sePrecdPodLine->Text;
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"订单查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  p->ShowModal();
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrecdQtyExit(TObject *Sender)
{
  double FVal,FTax,FQty,FPrice;
  if(sePrecdQty->Text.IsEmpty())
    sePrecdQty->Text="0";
  if(sePrecdPrice->Text.IsEmpty())
    sePrecdPrice->Text="0";
  if(scPrechTaxCode->ItemIndex!=-1)
    FTax=scPrechTaxCode->ItemData[cbItem3].ToDouble();
  else
    FTax=0;
  FQty=sePrecdQty->Text.ToDouble();
  FPrice=sePrecdPrice->Text.ToDouble();
  FVal=(FQty*FPrice)/(1+FTax);
  sePrecdAmt->Text=DataCarry(FVal,2,0);
  sePrecdTAmt->Text=DataCarry(FVal*FTax,2,0);
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrecdAmtExit(TObject *Sender)
{
/*
  double FVal,FTax,FQty,FPrice;
  if(sePrecdQty->Text.IsEmpty())
    sePrecdQty->Text="0";
  if(sePrecdPrice->Text.IsEmpty())
    sePrecdPrice->Text="0";
  if(scPrechTaxCode->ItemIndex!=-1)
    FTax=scPrechTaxCode->ItemData[cbItem3].ToDouble();
  else
    FTax=0;
  FQty=sePrecdQty->Text.ToDouble();
  FPrice=sePrecdPrice->Text.ToDouble();
  FVal=(FQty*FPrice)/(1+FTax);
  sePrecdAmt->Text=DataCarry(FVal,2,0);
  sePrecdTAmt->Text=DataCarry(FVal*FTax,2,0);
  反算单价
*/  
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrecdPoExit(TObject *Sender)
{
    if(g_sdRsGoods->LocateByKey(WideString(sePrecdGoods->Text))==0)
    {
      sePrecdGoodsName->Text=GetGoodsValue("GoodsName");
      if(GetGoodsValue("GoodsTrackSo")=="0")
      {//该物料不跟踪订单,则锁定销售单号和行号
        sePrecdSo->Enabled=false;
        sePrecdSodLine->Enabled=false;
        sePrecdSo->Text="";
        sePrecdSodLine->Text="0";
      }
      else
      {
        sePrecdSo->Enabled=true;
        sePrecdSodLine->Enabled=true;
      }
      if(GetGoodsValue("GoodsBatch")=="0")
      {//该物料不采用批次管理,则锁定批号
        scPrecdBatch->Enabled=false;
        scPrecdBatch->ItemIndex=-1;
      }
      else
      {
        scPrecdBatch->Enabled=true;
      }
    }
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrecdLocButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="002[货位编码][货位名称]select Loccode,LocName from sdLoc,sdLg where LocCode=lgLocCode and lgState=1 and ";
  SqlStr+=" lggoodscode='"+sePrecdGoods->Text+"' ";
  if(g_sdQuality == false) //无需质量管理
    SqlStr+= " and LocType=1 order by locCode";
  else                    //需要质量管理
    SqlStr+= " and LocType=3 order by loccode";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"货位查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    sePrecdLoc->LocateKey(p->ColData[1]);
  }
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrecdSoButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="004[销售订单][订单行号][物料编码][销售数量]select sodcode,sodline,sodgoods,sodqty from sdsod where ";
  SqlStr+="Sodgoods='"+sePrecdGoods->Text+"' order by SodCode";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"订单查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    sePrecdSo->Text=p->ColData[1];
    sePrecdSodLine->Text=p->ColData[2];
  }
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrechCurrencyButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="002[货币代码][货币名称]select Currencycode,CurrencyName from sdCurrency,sdpsd where PsdCurrencyCode=CurrencyCode and ";
  SqlStr+="PsdSupplyCode='"+scPrechSupply->ItemData[cbItem2]+"' order by CurrencyCode";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"货币查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
   sePrechCurrency->LocateKey(p->ColData[1]);
   sePrechEnrate->Text=sePrechCurrency->ItemData[cbItem3];
  }
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrechPsiteButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="003[货运地址代码][货运地址名称][联系人]select PsiteCode,PsiteName,psitelinkman from sdpsite where ";
  SqlStr+="PsiteSupplyCode='"+scPrechSupply->ItemData[cbItem2]+"' order by PsiteCode";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"货运地址查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    sePrechPsite->LocateKey(p->ColData[1]);
  }
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrechCurrencyExit(TObject *Sender)
{
 if(sePrechCurrency->ItemData[cbItem4]=="1")
 {
   sePrechEnrate->Enabled=false;
   sePrechEnrate->Text="1";
 }
 else
 {
   sePrechEnrate->Enabled=true;
 }
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::scPrechSupplyChange(TObject *Sender)
{
 sePrechCurrency->ItemIndex=-1;
 sePrechEnrate->Text="1";
 sePrechPsite->ItemIndex=-1;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPrech_P_I::sePrechCodeExit(TObject *Sender)
{
    if(CurrentState==caNormal && sePrechCode->Text != GetHeadValue(fiPrechCode))
    {
      comServer->LocateByKey(WideString(sePrechCode->Text));
      DisplayBill();
    }
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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