📄 sogh_s_o.cpp
字号:
void __fastcall TfrmSogh_S_O::seSoghCodeKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if(Key==13 && CurrentState==caNormal)
{
comServer->LocateByKey(WideString(seSoghCode->Text));
DisplayBill();
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_S_O::SetRelativeState(AnsiString GoodsCode)
{
int IsFound=g_sdRsGoods->LocateByKey(WideString(Trim(GoodsCode)));
if(IsFound != 0)
return;
seSogdGoods->Text=GetGoodsValue("GoodsCode");
seSogdGoodsName->Text=GetGoodsValue("GoodsName");
if(CurrentState!=caNormal)
{
if(GetGoodsValue("GoodsMUnit")=="0")
{
seSogdUnit->LocateKey(GetGoodsValue("GoodsUnitCode"));
seSogdUnit->Enabled=false;
seSogdConv->Enabled=false;
seSogdConv->Text="1";
}
else
{
seSogdUnit->Enabled=true;
seSogdConv->Enabled=true;
}
if(GetGoodsValue("GoodsBatch")=="0")
{
seSogdBatch->ItemIndex=-1;
seSogdBatch->Enabled=false;
}
else
seSogdBatch->Enabled=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_S_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_S_O::seSogdSoCodeButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="010[销售订单][行号][物料编码][计量单位][换算系数][销售数量][已发数][单价][折扣率][交货日期]";
SqlStr+="select sodcode,sodline,sodgoods,sodunit,sodConv,sodqty,sodsqty,sodprice,soddisc,SodRecDate from sdsod,sdsoh where sodcode=sohcode and sohcheck=1 and sohclose=0 and ";
SqlStr+="sohclient='"+seSoghClient->ItemData[cbItem2]+"' and sohcurrency='"+seSoghCurrency->ItemData[cbItem2]+"' order by sohdate desc,SodCode,SodLine";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"销售订单查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seSogdSoCode->Text=p->ColData[1];
seSogdSodLine->Text=p->ColData[2];
seSogdGoods->Text=p->ColData[3];
seSogdUnit->LocateKey(p->ColData[4]);
seSogdConv->Text=p->ColData[5];
deSogdRecDate->Text=p->ColData[10];
if(g_sdRsGoods->LocateByKey(WideString(seSogdGoods->Text))==0)
{
seSogdGoodsName->Text=GetGoodsValue("GoodsName");
if(GetGoodsValue("GoodsBatch")=="0")
{//该物料不采用批次管理,则锁定批号
seSogdBatch->Enabled=false;
seSogdBatch->ItemIndex=-1;
}
else
{
seSogdBatch->Enabled=true;
}
}
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_S_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_S_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_S_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_S_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_S_O::seSogdPriceExit(TObject *Sender)
{
CalculateAmt();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_S_O::seSogdDiscExit(TObject *Sender)
{
CalculateAmt();
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_S_O::seSogdQtyButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="005[当前月份][发货计量单位][未发数量][库存计量单位][库存数量]";
SqlStr+="select MaccFmonth,SodUnit,SodQty-SodSQty,GoodsUnitCode,MaccAoyQty from sdMacc,sdSod,sdGoods where MaccGoods=SodGoods and MaccGoods=GoodsCode and ";
SqlStr+=" MaccFmonth='"+g_sdSMonth+"' and SodCode='"+seSogdSoCode->Text+"' and SodLine="+seSogdSodLine->Text+" and MaccLoc='"+seSogdLoc->ItemData[cbItem2]+"'";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"库存查询",SqlStr);
}
__finally
{
EndWaitForm();
}
p->ShowModal();
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_S_O::seSogdPriceButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="007[订单号][订单行号][物料编码][订单数量][已发货数][单价][折扣]";
SqlStr+="select SodCode,SodLine,SodGoods,SodQty,SodSQty,SodPrice,SodDisc from SdSod where SodCode='"+seSogdSoCode->Text+"' and SodLine="+seSogdSodLine->Text;
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"订单单价查询",SqlStr);
}
__finally
{
EndWaitForm();
}
p->ShowModal();
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_S_O::seSogdDiscButtonClick(TObject *Sender)
{
AnsiString SqlStr;
SqlStr="007[订单号][订单行号][物料编码][订单数量][已发货数][单价][折扣]";
SqlStr+="select SodCode,SodLine,SodGoods,SodQty,SodSQty,SodPrice,SodDisc from SdSod where SodCode='"+seSogdSoCode->Text+"' and SodLine="+seSogdSodLine->Text;
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"订单折扣查询",SqlStr);
}
__finally
{
EndWaitForm();
}
p->ShowModal();
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmSogh_S_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 + -