📄 sreth.cpp
字号:
FVal=DataCarry(seSretdQty->Text.ToDouble()*seSretdPrice->Text.ToDouble(),2,0);
FAmt=DataCarry(FVal/(1+FTaxRate),2,0);
FTaxAmt=FVal-FAmt;//DataCarry(FAmt*FTaxRate,2,0);
seSretdAmt->Text=FAmt;
seSretdTaxAmt->Text=FTaxAmt;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSrethClientButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="005[客户编码][客户名称][主币种][主税种][客户地址]select clientcode,clientname,clientcurrency,clienttaxcode,clientaddr from sdclient where clientcancel=0 order by clientcode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"客户资料查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSrethClient->LocateKey(p->ColData[1]);
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSrethCurrencyButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="002[货币代码][货币名称]select Currencycode,CurrencyName from sdCurrency,sdssd where ssdCurrency=CurrencyCode and ";
SqlStr+="ssdClient='"+seSrethClient->ItemData[cbItem2]+"' order by CurrencyCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"客户货币查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
if(seSrethCurrency->LocateKey(p->ColData[1]))
{
if(seSrethCurrency->ItemData[cbItem4]=="1")
{
seSrethEnrate->Enabled=false;
seSrethEnrate->Text="1";
}
else
{
seSrethEnrate->Enabled=true;
seSrethEnrate->Text=seSrethCurrency->ItemData[cbItem3];
}
}
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSrethSsiteButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="003[货运地址代码][货运地址名称][联系人]select SsiteCode,SsiteName,Ssitelinkman from sdSsite where ";
SqlStr+="SsiteClient='"+seSrethClient->ItemData[cbItem2]+"' order by SsiteCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"货运地址查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSrethSsite->LocateKey(p->ColData[1]);
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSretdSogCodeButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="010[发货单号][行号][物料编码][计量单位][换算系数][发货数量][已退数][单价][货位][批号]";
SqlStr+="select sogdcode,sogdline,sogdgoods,sogdunit,sogdConv,sogdqty,sogdbqty,sogdprice,sogdloc,sogdbatch from sdsogd,sdsogh where sogdcode=soghcode and soghcheck=1 and soghclose=0 and ";
SqlStr+="soghclient='"+seSrethClient->ItemData[cbItem2]+"' and soghcurrency='"+seSrethCurrency->ItemData[cbItem2]+"' order by soghdate desc";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"销售发货单查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSretdSogCode->Text=p->ColData[1];
seSretdSogdLine->Text=p->ColData[2];
seSretdGoods->Text=p->ColData[3];
seSretdUnit->LocateKey(p->ColData[4]);
seSretdConv->Text=p->ColData[5];
if(g_sdRsGoods->LocateByKey(WideString(seSretdGoods->Text))==0)
seSretdGoodsName->Text=GetGoodsValue("GoodsName");
seSretdLoc->LocateKey(p->ColData[9]);
seSretdBatch->Text=p->ColData[10];
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::DynamicSetControlState()
{
if(scSrethType->ItemIndex==0)
{
tbGenDetail->Enabled=true;
ClientGroup->Remove(seSretdSogCode->Name);
ClientGroup->AddComponent(2,false,true,true,seSretdSogCode,seSretdSogCode->Name);
ClientGroup->Remove(seSretdGoods->Name);
ClientGroup->AddComponent(2,true,true,true,seSretdGoods,seSretdGoods->Name);
ClientGroup->Remove(seSretdUnit->Name);
ClientGroup->AddComponent(2,true,true,true,seSretdUnit,seSretdUnit->Name);
ClientGroup->Remove(seSretdConv->Name);
ClientGroup->AddComponent(2,true,true,true,seSretdConv,seSretdConv->Name);
ClientGroup->Remove(seSretdBatch->Name);
ClientGroup->AddComponent(2,true,true,true,seSretdBatch,seSretdBatch->Name);
}
else
{
tbGenDetail->Enabled=false;
ClientGroup->Remove(seSretdSogCode->Name);
ClientGroup->AddComponent(2,true,true,true,seSretdSogCode,seSretdSogCode->Name);
ClientGroup->Remove(seSretdGoods->Name);
ClientGroup->AddComponent(2,false,true,true,seSretdGoods,seSretdGoods->Name);
ClientGroup->Remove(seSretdUnit->Name);
ClientGroup->AddComponent(2,false,true,true,seSretdUnit,seSretdUnit->Name);
ClientGroup->Remove(seSretdConv->Name);
ClientGroup->AddComponent(2,false,true,true,seSretdConv,seSretdConv->Name);
ClientGroup->Remove(seSretdBatch->Name);
ClientGroup->AddComponent(2,false,true,true,seSretdBatch,seSretdBatch->Name);
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::scSrethTypeClick(TObject *Sender)
{
DynamicSetControlState();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSretdGoodsButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="006[物料编码][物料名称][计量单位][多计量单位][批次管理][订单管理]select GoodsCode,GoodsName,GoodsUnitCode,GoodsMUnit,GoodsBatch,GoodsTrackSo from sdgoods,sdsgd where ";
SqlStr+="sgdClientCode='"+seSrethClient->ItemData[1]+"' and SgdGoodsCode=GoodsCode order by GoodsCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"客户物料查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSretdGoods->Text=p->ColData[1];
SetRelativeState(seSretdGoods->Text);
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSretdUnitButtonClick(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='"+seSretdGoods->Text+"' ";
SqlStr+=" order by GmuPrimary desc,GmuUnit ";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"计量单位查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSretdUnit->LocateKey(p->ColData[1]);
seSretdConv->Text=p->ColData[3];
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSretdLocButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="002[货位编码][货位名称]select Loccode,LocName from sdLoc,sdLg where LocCode=lgLocCode and lgState=1 and ";
SqlStr+="lggoodscode='"+seSretdGoods->Text+"' order by LocCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"货位查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSretdLoc->LocateKey(p->ColData[1]);
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSretdQtyButtonClick(TObject *Sender)
{
AnsiString SqlStr;
TfrmWnQuery *p;
if(scSrethType->ItemIndex==0) //据发货单退货
{
SqlStr="008[发货单号][行号][物料编码][计量单位][换算系数][发货数量][已退数][单价]";
SqlStr+="select Sogdcode,Sogdline,Sogdgoods,Sogdunit,Sogdconv,Sogdqty,Sogdbqty,Sogdprice from sdSogd where ";
SqlStr+="Sogdcode='"+seSretdSogCode->Text+"' and SogdLine="+seSretdSogdLine->Text;
}
else //据客户退货
{
SqlStr="006[当前月份][货位名称][物料编码][物料名称][计量单位][当前数量]";
SqlStr+="select MaccFmonth,MaccLoc,MaccGoods,MaccGoodsName=GoodsName,MaccUnit=GoodsUnitCode,MaccAoyQty from sdMacc,sdGoods where GoodsCode=MaccGoods and MaccFmonth='"+g_sdSMonth+"'";
SqlStr+=" and MaccLoc='"+seSretdLoc->ItemData[1]+"' and MaccGoods='"+seSretdGoods->Text+"'";
}
try
{
StartWaitForm("正在查询,请稍候...");
if(scSrethType->ItemIndex==0)
p=new TfrmWnQuery(this,"发货单查询",SqlStr);
else
p=new TfrmWnQuery(this,"当前库存查询",SqlStr);
}
__finally
{
EndWaitForm();
}
p->ShowModal();
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSretdQtyExit(TObject *Sender)
{
CalculateAmt();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSretdPriceExit(TObject *Sender)
{
CalculateAmt();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSreth::seSretdBatchButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="005[批号代码][说明][数量][生效日期][失效日期]";
SqlStr+=" select BatchCode,BatchDesc,BatchQty,BatchEffectDate,BatchAbateDate from sdBatch";
SqlStr+=" where BatchEffectDate<='"+g_sdCurDate+"' and BatchAbateDate>'"+g_sdCurDate+"' order by BatchCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"批号查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSretdBatch->LocateKey(p->ColData[1]);
}
delete p;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -