gosd.cpp
来自「科思ERP部分源码及控件」· C++ 代码 · 共 437 行 · 第 1/2 页
CPP
437 行
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TfrmGosd::sgGosdDblClick(TObject *Sender)
{
AnsiString SqlStr;
int ARow=sgGosd->Row;
if (ARow >0)
{
if(sgGosd->Col==1)
{
if (sgGosd->Cells[1][ARow] == "√")
{
sgGosd->Cells[1][ARow] = "";
for (int i=1;i<sgGosd->RowCount;i++)
{
if(sgGosd->Cells[1][i]=="√")
{
btnOK->Enabled=true;
break;
}
else
btnOK->Enabled=false;
}
}
else
{
sgGosd->Cells[1][ARow] = "√";
btnOK->Enabled=true;
}
}
else if(sgGosd->Col==9 && sgGosd->Cells[1][ARow] == "√")
{
SqlStr="002[货位代码][货位名称]select loccode,locname from sdLoc,sdlg ";
SqlStr+=" where lgLoccode=loccode and lggoodscode='"+sgGosd->Cells[3][ARow]+"'";
if(Trim(GetParamValue("10520"))=='Y')
SqlStr+=" and loccode in(select LrLoc from KsLocRight where LrUser= '"+g_sdUserCode+"') ";
SqlStr+=" and LocType=1 order by locCode";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"货位查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
sgGosd->Cells[9][ARow]=p->ColData[1];
}
delete p;
}
else if(sgGosd->Col==10 && sgGosd->Cells[1][ARow] == "√"&&wetherBatch(sgGosd->Cells[3][ARow]))//选择批次
{
SqlStr="006[批次代码][货位][财务月份][入库数量][入库金额][结存数量]";
SqlStr+=" select BthtBatch,BthtLoc,BthtFmonth,BthtIopQty,BthtOopQty,BthtAoyQty from sdbtht where bthtGoods='" + Trim(sgGosd->Cells[3][ARow])+ "' order by bthtbatch ";
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"货位查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
sgGosd->Cells[10][ARow]=p->ColData[1];
}
delete p;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmGosd::seGosdFromCodeButtonClick(TObject *Sender)
{
AnsiString SqlStr;
switch(pv_GoshType)
{
case 1: //销售发货
/*SqlStr="006[销售发货单][发货日期][客户][币种][税码][操作员]";
SqlStr+="select SoghCode,SoghDate,ClientName,CurrencyName,isnull(TaxName,''),SoghUser from sdSogh,sdClient,sdCurrency,sdTax";
SqlStr+=" where Soghcurrency=currencycode and Soghtaxcode*=taxcode and Soghcheck=1 and Soghclose=0 and Soghcancel=0 ";
SqlStr+=" and SoghClient=ClientCode order by Soghcode";
*/
SqlStr="006[销售发货单][发货日期][客户][币种][税码][操作员]";
SqlStr+="select SoghCode,SoghDate,ClientName,CurrencyName,isnull(TaxName,''),SoghUser from sdSogh,sdClient,sdCurrency,sdTax";
SqlStr+=" where Soghcurrency=currencycode and Soghtaxcode*=taxcode and Soghcheck=1 and Soghclose=0 and Soghcancel=0 and SoghClient=ClientCode and SoghCode in(select distinct(SogdCode) from sdSogd,sdGoods where SogdGoods=GoodsCode and SogdClose=0 and SogdCode in (select SoghCode from sdSogh,sdClient,sdCurrency,sdTax where Soghcurrency=currencycode and Soghtaxcode*=taxcode and Soghcheck=1 and Soghclose=0 and Soghcancel=0 and SoghClient=ClientCode ) and SogdQty>SogdOQty ) order by Soghcode";
break;
case 2: //采购退货
/*SqlStr="006[采购退货单][退货日期][供应商][币种][税码][操作员]";
SqlStr+="select PrethCode,PrethDate,SupplyName,CurrencyName,isnull(TaxName,''),PrethUser from sdPreth,sdSupply,sdCurrency,sdTax";
SqlStr+=" where Prethcurrency=currencycode and Prethtaxcode*=taxcode and Prethcheck=1 and Prethclose=0 and Prethcancel=0 ";
SqlStr+=" and PrethSupply=SupplyCode order by Prethcode";
*/
SqlStr="006[采购退货单][退货日期][供应商][币种][税码][操作员]";
SqlStr+="select PrethCode,PrethDate,SupplyName,CurrencyName,isnull(TaxName,''),PrethUser from sdPreth,sdSupply,sdCurrency,sdTax";
SqlStr+=" where Prethcurrency=currencycode and Prethtaxcode*=taxcode and Prethcheck=1 and Prethclose=0 and Prethcancel=0 ";
SqlStr+=" and PrethCode in(select PretdCode from sdPretd,sdGoods where PretdGoods=GoodsCode and PretdClose=0 and PretdCode in (select PrethCode from sdPreth,sdSupply,sdCurrency,sdTax where Prethcurrency=currencycode and Prethtaxcode*=taxcode and Prethcheck=1 and Prethclose=0 and Prethcancel=0 and PrethSupply=SupplyCode ) and PretdQty>0) order by Prethcode ";
break;
case 3: //退料
/*SqlStr="006[生产领料单][财务月份][领料日期][工单号][领料部门][操作员]";
SqlStr+="SELECT GmthCode,GmthFMonth,GmthDate,GmthWoCode,GmthDept,GmthUser ";
SqlStr+="FROM sdGmth ";
SqlStr+="WHERE GmthCheck=1";
*/
SqlStr="006[生产领料单][财务月份][领料日期][工单号][领料部门][操作员]";
SqlStr+="SELECT GmthCode,GmthFMonth,GmthDate,GmthWoCode,GmthDept,GmthUser ";
SqlStr+="FROM sdGmth ";
SqlStr+="WHERE GmthCode in(SELECT GmtdCode FROM sdGmtd,sdGoods WHERE GmtdGoods=GoodsCode and GmtdCode in(SELECT GmthCode FROM sdGmth WHERE GmthCheck=1) and GmtdQty>GmtdOQty ) order by GmthCode";
break;
default:
SqlStr="";
break;
}
if(SqlStr=="")
return;
TfrmWnQuery *p;
try
{
StartWaitForm("正在查询,请稍候...");
p=new TfrmWnQuery(this,"出库来源单据查询",SqlStr);
}
__finally
{
EndWaitForm();
}
if(p->ShowModal()==mrOk)
{
seGosdFromCode->Text=p->ColData[1];
FillGridWithData();
}
delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGosd::bbSelAllClick(TObject *Sender)
{
if(sgGosd->RowCount <=1)
return;
for(int i=1;i<sgGosd->RowCount;i++)
sgGosd->Cells[1][i] = "√";
btnOK->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGosd::bbSelNoneClick(TObject *Sender)
{
for(int i=1;i<sgGosd->RowCount;i++)
sgGosd->Cells[1][i] = "";
btnOK->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGosd::sgGosdSelectCell(TObject *Sender, int ACol,
int ARow, bool &CanSelect)
{
if(sgGosd->Cells[1][ARow]=="√")
sgGosd->ReadOnly=false;
else
sgGosd->ReadOnly=true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmGosd::sgGosdSetEditText(TObject *Sender,
int ACol, int ARow, const AnsiString Value)
{
if(sgGosd->Cells[1][ARow]=="√")
{
if(ACol == 7)
sgGosd->Cells[8][ARow]=Value;
}
}
//---------------------------------------------------------------------------
bool __fastcall TfrmGosd::wetherBatch(AnsiString Value)
{
TComResultSet *RsQuery=new TComResultSet(Handle,g_ClientHandle);
AnsiString ItemStr="",m_SQL;
m_SQL="select GoodsBatch from sdGoods where GoodsCode='"+Value +"'" ;
try
{
RsQuery->Open(m_SQL,"");
//int ll=RsQuery->RecordCount;
RsQuery->MoveFirst();
while( !RsQuery->Eof)
{
ItemStr=RsQuery->FieldByName("goodsbatch");
RsQuery->MoveNext();
}
RsQuery->Close();
}
__finally
{
delete RsQuery;
}
if (StrToInt(ItemStr)==0)
ll_GoodsBatch=false;
else if(StrToInt(ItemStr)==1)
ll_GoodsBatch=true;
return (ll_GoodsBatch);
}
//--------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?