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

📄 poh.cpp

📁 速达开源ERP系统
💻 CPP
📖 第 1 页 / 共 3 页
字号:
{
  int IsFound=g_sdRsGoods->LocateByKey(WideString(Trim(gc)));
  if(IsFound != 0) //输入无效编码
  {
    sePodGoods->Text=pv_GoodsCode;
    return;
  }
   sePodGoods->Text=GetGoodsValue("GoodsCode");
   sePodGoodsName->Text=GetGoodsValue("GoodsName");
   sePodUnit->LocateKey(GetGoodsValue("GoodsUnitCode"));
   if(GetGoodsValue("GoodsTrackSo")=="0")
   {//该物料不跟踪订单,则锁定销售单号和行号
    sePodSo->Enabled=false;
    sePodSo->Text="";
    sePodSodLine->Text="";
   }
   else
   {
    sePodSo->Enabled=true;
   }
   if(GetGoodsValue("GoodsBatch")=="0")
   {//该物料不采用批次管理,则锁定批号
    scPodBatch->Enabled=false;
    scPodBatch->ItemIndex=-1;
   }
   else
   {
    scPodBatch->Enabled=true;
   }
   if(gc == pv_GoodsCode)
   //修改行且物料代码没有改变时,不再填充下拉框
    return;
   pv_GoodsCode=gc;

}
//---------------------------------------------------------------------------
void __fastcall TfrmPoh::GenrateBill()
{
    int TempCount;
    TempCount = comServer->ItemCount;
    StartWaitForm("正在启动生成界面");
    TfrmPod *p=new TfrmPod(this);
    try
    {
      p->GetComObject(comServer);
      EndWaitForm();
      p->ShowModal();
      if (TempCount < comServer->ItemCount)
        TGenBaseForm::SaveRecord();
      else
        CancelChange();
    }
    __finally
    {
      delete p;
    }
}
//---------------------------------------------------------------------------


void __fastcall TfrmPoh::scPodDeptExit(TObject *Sender)
{
  CheckComboBoxText(scPodDept);
}
//---------------------------------------------------------------------------


void __fastcall TfrmPoh::scPodBatchExit(TObject *Sender)
{
 CheckComboBoxText(scPodBatch);
}
//---------------------------------------------------------------------------


void __fastcall TfrmPoh::scPohTaxCodeExit(TObject *Sender)
{
 CheckComboBoxText(scPohTaxCode);
}
//---------------------------------------------------------------------------



void __fastcall TfrmPoh::scPohSupplyClick(TObject *Sender)
{
    if(scPohTaxCode->Enabled)
     scPohTaxCode->LocateKey(scPohSupply->ItemData[cbItem3]);
}
//---------------------------------------------------------------------------

void __fastcall TfrmPoh::sePodQtyExit(TObject *Sender)
{
  double FVal;
  if(sePodQty->Text.IsEmpty())
    sePodQty->Text="0";
  if(sePodPrice->Text.IsEmpty())
    sePodPrice->Text="0";
  FVal=sePodQty->Text.ToDouble()*sePodPrice->Text.ToDouble();
  sePodAmt->Text=DataCarry(FVal,2,0);
}
//---------------------------------------------------------------------------


void __fastcall TfrmPoh::sePodPriceExit(TObject *Sender)
{
  double FVal;
  if(sePodQty->Text.IsEmpty())
    sePodQty->Text="0";
  if(sePodPrice->Text.IsEmpty())
    sePodPrice->Text="0";
  FVal=sePodQty->Text.ToDouble()*sePodPrice->Text.ToDouble();
  sePodAmt->Text=DataCarry(FVal,2,0);
}
//---------------------------------------------------------------------------


void __fastcall TfrmPoh::sePodSoButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="005[订单号][订单行号][客户名称][物料编码][物料名称]select sohcode,sodline,ClientName,sodgoods,goodsname from sdsoh,sdclient,sdsod,sdgoods";
  SqlStr+=" where sohcheck=1 and sohclient=clientcode  and sohcode=sodcode and sodgoods=goodscode and sodgoods='"+sePodGoods->Text+"' order by sohcode";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"订单查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    sePodSo->Text=p->ColData[1];
    sePodSodLine->Text=p->ColData[2];
  }
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPoh::sePohCurrencyButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="003[货币代码][货币名称][币种类别]select Currencycode,CurrencyName,Prm=(case when PsdPrimary=1 then '主币种' else '辅币种' end) ";
  SqlStr+=" from sdCurrency,sdpsd where PsdCurrencyCode=CurrencyCode and ";
  SqlStr+=" PsdSupplyCode='"+scPohSupply->ItemData[cbItem2]+"' order by CurrencyCode";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"货币查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    sePohCurrency->LocateKey(p->ColData[1]);
    sePohEnrate->Text=sePohCurrency->ItemData[cbItem3];
  }
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPoh::sePodUnitButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="004[计量单位代码][计量单位名称][换算系数][单位类型]";
  SqlStr+=" select GmuUnit,UnitName,GmuConv,Prm=(case when GmuPrimary=1 then '主单位' else '辅助单位' end) ";
  SqlStr+=" from sdGmu,sdUnit where GmuUnit=UnitCode and GmuGoods='"+sePodGoods->Text+"' ";
  SqlStr+=" order by GmuPrimary desc,GmuUnit  ";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"计量单位查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    sePodUnit->LocateKey(p->ColData[1]);
    sePodConvRate->Text=p->ColData[3];
  }
  delete p;
}
//---------------------------------------------------------------------------

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

void __fastcall TfrmPoh::sePodLocButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  TfrmWnQuery *p;
  SqlStr="002[货位编码][货位名称]select Loccode,LocName from sdLoc,sdLg where LocCode=lgLocCode and lgState=1 and ";
  SqlStr+=" LocType=1 and lggoodscode='"+sePodGoods->Text+"' order by LocCode";
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"货位查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    sePodLoc->LocateKey(p->ColData[1]);
  }
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPoh::sePodQtyButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  TfrmWnQuery *p;
  SqlStr="005[当前月份][物料编码][物料名称][计量单位][当前数量]";
  SqlStr+="select StockFmonth,StockGoodsCode,StockGoodsName=GoodsName,StockUnit=GoodsUnitCode,StockAoyQty from sdStock,sdGoods where GoodsCode=StockGoodsCode and StockFmonth='"+g_sdPMonth+"'";
  SqlStr+=" and StockGoodsCode='"+sePodGoods->Text+"'";
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"当前库存查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  p->ShowModal();
  delete p;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPoh::sePohCurrencyExit(TObject *Sender)
{
 if(sePohCurrency->ItemData[cbItem4]=="1")
 {
   sePohEnrate->Enabled=false;
   sePohEnrate->Text="1";
 }
 else
 {
   sePohEnrate->Enabled=true;
 }
}
//---------------------------------------------------------------------------

void __fastcall TfrmPoh::scPohSupplyChange(TObject *Sender)
{
 sePohCurrency->ItemIndex=-1;
 sePohEnrate->Text="1";
 sePohPsite->ItemIndex=-1;
}
//---------------------------------------------------------------------------

void __fastcall TfrmPoh::sePodPriceButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  TfrmWnQuery *p;
  SqlStr="004[启始数量段][终止数量段][价格][折扣]";
  SqlStr+="select f0=0,f1=pquoteqty1,f2=pquoteprice1,f3=pquoterebate1 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty1,f1=pquoteqty2,f2=pquoteprice2,f3=pquoterebate2 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty2,f1=pquoteqty3,f2=pquoteprice3,f3=pquoterebate3 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty3,f1=pquoteqty4,f2=pquoteprice4,f3=pquoterebate4 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty4,f1=pquoteqty5,f2=pquoteprice5,f3=pquoterebate5 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty5,f1=pquoteqty6,f2=pquoteprice6,f3=pquoterebate6 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty6,f1=pquoteqty7,f2=pquoteprice7,f3=pquoterebate7 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty7,f1=pquoteqty8,f2=pquoteprice8,f3=pquoterebate8 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty8,f1=pquoteqty9,f2=pquoteprice9,f3=pquoterebate9 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"' union all ";
  SqlStr+="select f0=pquoteqty9,f1=pquoteqty10,f2=pquoteprice10,f3=pquoterebate10 from sdpquote where pquotesupply='"+scPohSupply->ItemData[cbItem2]+"' and pquotecurrency='"+sePohCurrency->ItemData[cbItem2]+"' and pquotegoods='"+sePodGoods->Text+"'";
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"产品报价单查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  p->ShowModal();
  delete p;  
}
//---------------------------------------------------------------------------

void __fastcall TfrmPoh::sePohCodeExit(TObject *Sender)
{
    if(CurrentState==caNormal && sePohCode->Text != GetHeadValue(fiPohCode))
    {
      comServer->LocateByKey(WideString(sePohCode->Text));
      DisplayBill();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmPoh::UnDoChange()
{
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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