📄 sogh_n_o.cpp
字号:
seSogdBatch->Enabled=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::CalculateAmt()
{
double FAmt,FTaxAmt,FVal,FTaxRate,FDiscAmt;
if(scSoghTaxCode->ItemIndex!=-1)
FTaxRate=scSoghTaxCode->ItemData[cbItem3].ToDouble();
FVal=DataCarry(seSogdQty->Text.ToDouble()*seSogdPrice->Text.ToDouble(),2,0);
FAmt=DataCarry(FVal/(1+FTaxRate),2,0);
FTaxAmt=FVal-FAmt;//DataCarry(FAmt*FTaxRate,2,0);
FDiscAmt=DataCarry((FAmt+FTaxAmt)*(seSogdDisc->Text.ToDouble()),2,0);
seSogdAmt->Text=FAmt;
seSogdTaxAmt->Text=FTaxAmt;
seSogdDAmt->Text=FDiscAmt;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSoghClientButtonClick(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)
{
seSoghClient->LocateKey(p->ColData[1]);
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSoghCurrencyButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="002[货币代码][货币名称]select Currencycode,CurrencyName from sdCurrency,sdssd where ssdCurrency=CurrencyCode and ";
SqlStr+="ssdClient='"+seSoghClient->ItemData[cbItem2]+"' order by CurrencyCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"客户货币查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
if(seSoghCurrency->LocateKey(p->ColData[1]))
{
if(seSoghCurrency->ItemData[cbItem4]=="1")
{
seSoghEnrate->Enabled=false;
seSoghEnrate->Text="1";
}
else
{
seSoghEnrate->Enabled=true;
seSoghEnrate->Text=seSoghCurrency->ItemData[cbItem3];
}
}
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSoghSsiteButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="003[货运地址代码][货运地址名称][联系人]select SsiteCode,SsiteName,Ssitelinkman from sdSsite where ";
SqlStr+="SsiteClient='"+seSoghClient->ItemData[cbItem2]+"' order by SsiteCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"货运地址查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSoghSsite->LocateKey(p->ColData[1]);
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdLocButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="002[货位编码][货位名称]select LocCode,LocName from sdLoc,sdLg where LocCode=lgLocCode and lgState=1 and ";
SqlStr+="lggoodscode='"+seSogdGoods->Text+"' order by LocCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"货位查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSogdLoc->LocateKey(p->ColData[1]);
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdPriceExit(TObject *Sender)
{
CalculateAmt();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdDiscExit(TObject *Sender)
{
CalculateAmt();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdQtyButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="003[当前月份][计量单位][库存数量]";
SqlStr+="select MaccFmonth,GoodsUnitCode,MaccAoyQty from sdMacc,sdGoods where MaccGoods=GoodsCode and ";
SqlStr+=" MaccFmonth='"+g_sdSMonth+"' and MaccLoc='"+seSogdLoc->ItemData[cbItem2]+"' and MaccGoods='"+seSogdGoods->Text+"'";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"库存查询",SqlStr);
}
__finally
{
EndWaitForm();
}
p->ShowModal();
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdPriceButtonClick(TObject *Sender)
{
AnsiString SqlStr;
TfrmWnQuery *p;
SqlStr="004[启始数量段][终止数量段][价格][折扣]";
SqlStr+="select f0=0,f1=squoteqty1,f2=squoteprice1,f3=squoterebate1 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty1,f1=squoteqty2,f2=squoteprice2,f3=squoterebate2 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty2,f1=squoteqty3,f2=squoteprice3,f3=squoterebate3 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty3,f1=squoteqty4,f2=squoteprice4,f3=squoterebate4 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty4,f1=squoteqty5,f2=squoteprice5,f3=squoterebate5 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty5,f1=squoteqty6,f2=squoteprice6,f3=squoterebate6 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty6,f1=squoteqty7,f2=squoteprice7,f3=squoterebate7 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty7,f1=squoteqty8,f2=squoteprice8,f3=squoterebate8 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty8,f1=squoteqty9,f2=squoteprice9,f3=squoterebate9 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty9,f1=squoteqty10,f2=squoteprice10,f3=squoterebate10 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"'";
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"产品报价单查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSogdPrice->Text=p->ColData[3];
seSogdDisc->Text=p->ColData[4];
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdDiscButtonClick(TObject *Sender)
{
AnsiString SqlStr;
TfrmWnQuery *p;
SqlStr="004[启始数量段][终止数量段][价格][折扣]";
SqlStr+="select f0=0,f1=squoteqty1,f2=squoteprice1,f3=squoterebate1 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty1,f1=squoteqty2,f2=squoteprice2,f3=squoterebate2 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty2,f1=squoteqty3,f2=squoteprice3,f3=squoterebate3 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty3,f1=squoteqty4,f2=squoteprice4,f3=squoterebate4 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty4,f1=squoteqty5,f2=squoteprice5,f3=squoterebate5 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty5,f1=squoteqty6,f2=squoteprice6,f3=squoterebate6 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty6,f1=squoteqty7,f2=squoteprice7,f3=squoterebate7 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty7,f1=squoteqty8,f2=squoteprice8,f3=squoterebate8 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty8,f1=squoteqty9,f2=squoteprice9,f3=squoterebate9 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"' union all ";
SqlStr+="select f0=squoteqty9,f1=squoteqty10,f2=squoteprice10,f3=squoterebate10 from sdsquote where squoteclient='"+seSoghClient->ItemData[cbItem2]+"' and squotecurrency='"+seSoghCurrency->ItemData[cbItem2]+"' and squotegoods='"+seSogdGoods->Text+"'";
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"产品折扣查询",SqlStr);
}
__finally
{
EndWaitForm();
}
p->ShowModal();
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdGoodsButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="005[货物编码][货物名称][单位][客户货物编码][客户货物名称]select SgdGoodsCode,";
SqlStr+="GoodsName,GoodsUnitCode,SgdCode,SgdName from SdSgd,sdGoods where SgdClientCode='"+seSoghClient->ItemData[1]+"' and ";
SqlStr+="SgdGoodsCode=GoodsCode order by SgdGoodsCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"客户货物查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSogdGoods->Text=p->ColData[1];
seSogdGoodsName->Text=p->ColData[2];
seSogdUnit->LocateKey(p->ColData[3]);
seSogdConv->Text="1";
SetRelativeState(seSogdGoods->Text);
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdUnitButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr ="003[计量单位][单位名称][换算系数]";
SqlStr+="SELECT GmuUnit,UnitName,GmuConv from sdGmu,sdUnit where GmuUnit=UnitCode and ";
SqlStr+="GmuGoods='"+seSogdGoods->Text+"' order by GmuUnit ";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"计量单位查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSogdUnit->LocateKey(p->ColData[1]);
seSogdConv->Text=p->ColData[3];
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdGoodsExit(TObject *Sender)
{
SetRelativeState(seSogdGoods->Text);
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_N_O::seSogdBatchButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="002[批号编码][说明]select Batchcode,BatchDesc from sdBatch order by BatchCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"批号查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSogdBatch->LocateKey(p->ColData[1]);
}
delete p;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -