?? curr.cpp
字號(hào):
suiDBComboBox3->Items->Add(dm->artcode->FieldByName("article_code")->AsString);
dm->artcode->Next();
}
dm->dept->Active=false;
dm->sect->Active=false;
dm->artcode->Active=false;
suiButton2->Enabled=false;
suiComboBox1->Text=store;
}
//---------------------------------------------------------------------------
void __fastcall Tcurren::suiDBComboBox2DblClick(TObject *Sender)
{
AnsiString str ;
suiButton2->Enabled=true;
str="select store,TIME ,itmaster.dept_code,itmaster.section_code,itmaster.article_code,itmaster.vendor_code,currentemp.item_code,itmaster.item_desc ,itmaster.stock_onhand, points as quantity, customs,round((netamt/points),2) as price , netamt FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code" ;
str=str+" where points<>0 and customs>0 ";
if (!suiComboBox1->Text.IsEmpty()){
str=str+" and store='"+ Trim(suiComboBox1->Text)+"'";
}
if (!suiDBComboBox2->Text.IsEmpty()){
str=str+" and itmaster.section_code='"+ Trim(suiDBComboBox2->Text)+"'";
}else
return;
try{
dm->dayseq->Active=false;
dm->dayseq->SQL->Clear();
dm->dayseq->SQL->Add(str);
dm->dayseq->Active=true;
}
catch(...){
}
if (!suiComboBox1->Text.IsEmpty()){
str="select store,sum(points) as customs from currentemp where item_code like 'SEC"+Trim(suiDBComboBox2->Text)+"%' and store='"+Trim(suiComboBox1->Text)+"' group by store,item_code";
}else {
str="select sum(points) as customs from currentemp where item_code like 'SEC"+Trim(suiDBComboBox2->Text)+"%' group by item_code";
}
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
dm->tmp->Active=false;
}
if (suiComboBox1->Text.IsEmpty()){
suiStatusBar1->SimpleText="店鋪:各店鋪 組別"+suiDBComboBox1->Text+" 即時(shí)客數(shù)為"+dm->tmp->FieldByName("customs")->AsInteger;;
}else
suiStatusBar1->SimpleText="店鋪:"+Trim(suiComboBox1->Text)+" 組別"+suiDBComboBox2->Text+" 即時(shí)客數(shù)為"+dm->tmp->FieldByName("customs")->AsInteger;
if (suiComboBox1->Text.IsEmpty()){
str="select sum(netamt) as netamts FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code where points<>0 and customs>0 and section_code='"+Trim(suiDBComboBox2->Text)+"' group by section_code";
}else {
str= "select sum(netamt) as netamts FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code where points<>0 and customs>0 and section_code='"+Trim(suiDBComboBox2->Text)+"' and store='"+Trim(suiComboBox1->Text)+"' group by store,section_code";
}
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
dm->tmp->Active=false;
}
suiStatusBar1->SimpleText=suiStatusBar1->SimpleText+" 總金額為"+dm->tmp->FieldByName("netamts")->AsFloat;
}
//---------------------------------------------------------------------------
void __fastcall Tcurren::suiDBComboBox3DblClick(TObject *Sender)
{
AnsiString str ;
suiButton2->Enabled=true;
str="select store,TIME ,itmaster.dept_code,itmaster.section_code,itmaster.article_code,itmaster.vendor_code,currentemp.item_code,itmaster.item_desc ,itmaster.stock_onhand, points as quantity, customs,round((netamt/points),2) as price , netamt FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code" ;
str=str+" where points<>0 and customs>0 ";
if (!suiComboBox1->Text.IsEmpty()){
str=str+" and store='"+ Trim(suiComboBox1->Text)+"'";
}
if (!suiDBComboBox3->Text.IsEmpty()){
str=str+" and itmaster.article_code='"+ Trim(suiDBComboBox3->Text)+"'";
}else
return;
try{
dm->dayseq->Active=false;
dm->dayseq->SQL->Clear();
dm->dayseq->SQL->Add(str);
dm->dayseq->Active=true;
}
catch(...){
}
if (!suiComboBox1->Text.IsEmpty()){
str="select store,sum(points) as customs from currentemp where item_code like 'art"+Trim(suiDBComboBox3->Text)+"%' and store='"+Trim(suiComboBox1->Text)+"' group by store,item_code";
}else {
str="select sum(points) as customs from currentemp where item_code like 'art"+Trim(suiDBComboBox3->Text)+"%' group by item_code";
}
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
dm->tmp->Active=false;
}
if (suiComboBox1->Text.IsEmpty()){
suiStatusBar1->SimpleText="店鋪:各店鋪 小組別"+suiDBComboBox3->Text+" 即時(shí)客數(shù)為"+dm->tmp->FieldByName("customs")->AsInteger;;
}else
suiStatusBar1->SimpleText="店鋪:"+Trim(suiComboBox1->Text)+" 小組別"+suiDBComboBox3->Text+" 即時(shí)客數(shù)為"+dm->tmp->FieldByName("customs")->AsInteger;
if (suiComboBox1->Text.IsEmpty()){
str="select sum(netamt) as netamts FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code where points<>0 and customs>0 and article_code='"+Trim(suiDBComboBox3->Text)+"' group by article_code";
}else {
str= "select sum(netamt) as netamts FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code where points<>0 and customs>0 and article_code='"+Trim(suiDBComboBox3->Text)+"' and store='"+Trim(suiComboBox1->Text)+"' group by store,article_code";
}
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
dm->tmp->Active=false;
}
suiStatusBar1->SimpleText=suiStatusBar1->SimpleText+" 總金額為"+dm->tmp->FieldByName("netamts")->AsFloat;
}
//---------------------------------------------------------------------------
void __fastcall Tcurren::suiButton2Click(TObject *Sender)
{
if (dm->dayseq->RecordCount==0)
return;
if (dm->dayseq->Active){
SaveDialog1->Filter = "EXCEL files (*.xls)|*.XLS";
if(SaveDialog1->Execute()){
dm->LOCAL->DatabaseName=SaveDialog1->InitialDir;
dm->LOCAL->TableName=SaveDialog1->FileName;
// SaveDialog1->FileName;
try{
dm->TOEXCEL->Source=dm->dayseq;
dm->TOEXCEL->Execute() ;
}catch(...){
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall Tcurren::suiEdit1DblClick(TObject *Sender)
{
AnsiString str ;
suiButton2->Enabled=true;
str="select store,TIME ,itmaster.dept_code,itmaster.section_code,itmaster.article_code,itmaster.vendor_code,currentemp.item_code,itmaster.item_desc ,itmaster.stock_onhand, points as quantity, customs,round((netamt/points),2) as price , netamt FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code" ;
str=str+" where points<>0 and customs>0 ";
if (!suiComboBox1->Text.IsEmpty()){
str=str+" and store='"+ Trim(suiComboBox1->Text)+"'";
}
if (!suiDBComboBox3->Text.IsEmpty()){
str=str+" and currentemp.item_code='"+ Trim(suiEdit1->Text)+"'";
}else
return;
try{
dm->dayseq->Active=false;
dm->dayseq->SQL->Clear();
dm->dayseq->SQL->Add(str);
dm->dayseq->Active=true;
}
catch(...){
}
if (!suiComboBox1->Text.IsEmpty()){
str="select store,sum(points) as customs from currentemp where item_code like '"+Trim(suiEdit1->Text)+"%' and store='"+Trim(suiComboBox1->Text)+"' group by store,item_code";
}else {
str="select sum(points) as customs from currentemp where item_code like '"+Trim(suiEdit1->Text)+"%' group by item_code";
}
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
dm->tmp->Active=false;
}
if (suiComboBox1->Text.IsEmpty()){
suiStatusBar1->SimpleText="店鋪:各店鋪 item_code"+suiEdit1->Text+" 即時(shí)客數(shù)為"+dm->tmp->FieldByName("customs")->AsInteger;;
}else
suiStatusBar1->SimpleText="店鋪:"+Trim(suiComboBox1->Text)+" item_code"+suiEdit1->Text+" 即時(shí)客數(shù)為"+dm->tmp->FieldByName("customs")->AsInteger;
if (suiComboBox1->Text.IsEmpty()){
str="select sum(netamt) as netamts FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code where points<>0 and customs>0 and currentemp.item_code='"+Trim(suiDBComboBox3->Text)+"' group by currentemp.item_code";
}else {
str= "select sum(netamt) as netamts FROM CURRENTEMP left join itmaster on CURRENTEMP.item_code=itmaster.item_code where points<>0 and customs>0 and currentemp.item_code='"+Trim(suiDBComboBox3->Text)+"' and store='"+Trim(suiComboBox1->Text)+"' group by store,currentemp.item_code";
}
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
dm->tmp->Active=false;
}
suiStatusBar1->SimpleText=suiStatusBar1->SimpleText+" 總金額為"+dm->tmp->FieldByName("netamts")->AsFloat;
}
//---------------------------------------------------------------------------
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -