📄 curr.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "curr.h"
#include "mainform.h"
#include "datam.h"
#include "sas.h"
#include "daysql.h"
#include "prt.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SUIForm"
#pragma link "SUIButton"
#pragma link "SUIComboBox"
#pragma link "SUIDBCtrls"
#pragma link "SUIEdit"
#pragma link "SUIGroupBox"
#pragma link "SUIImagePanel"
#pragma link "SUIStatusBar"
#pragma link "SUIListBox"
#pragma resource "*.dfm"
Tcurren *curren;
//---------------------------------------------------------------------------
__fastcall Tcurren::Tcurren(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tcurren::suiButton4Click(TObject *Sender)
{
AnsiString str ;
suiPanel1->Pop();
suiButton1->Enabled=true;
str="select * FROM tmpsummday where item_code>'a'";
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}
catch(...){
}
suiEdit1->Text="";
suiStatusBar1->SimpleText="全店铺 查询时间从";
}
//---------------------------------------------------------------------------
void __fastcall Tcurren::suiComboBox1DblClick(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)+"'";
}
try{
dm->dayseq->Active=false;
dm->dayseq->SQL->Clear();
dm->dayseq->SQL->Add(str);
dm->dayseq->Active=true;
}
catch(...){
}
str="select store,sum(points) as customs from currentemp where item_code like 'str"+Trim(suiComboBox1->Text)+"%' group by store";
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="店铺:各店铺 即时客数为"+dm->tmp->FieldByName("customs")->AsInteger;
}else
suiStatusBar1->SimpleText="店铺:"+Trim(suiComboBox1->Text)+" 即时客数为"+dm->tmp->FieldByName("customs")->AsInteger;
str="select sum(netamt) as netamts from currentemp where points<>0 and customs>0 group by store";
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::suiDBComboBox1DblClick(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 (!suiDBComboBox1->Text.IsEmpty()){
str=str+" and itmaster.dept_code='"+ Trim(suiDBComboBox1->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 'dpt"+Trim(suiDBComboBox1->Text)+"%' and store='"+Trim(suiComboBox1->Text)+"' group by store,item_code";
}else {
str="select sum(points) as customs from currentemp where item_code like 'dpt"+Trim(suiDBComboBox1->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+" 即时客数为"+dm->tmp->FieldByName("customs")->AsInteger;;
}else
suiStatusBar1->SimpleText="店铺:"+Trim(suiComboBox1->Text)+" 部门"+suiDBComboBox1->Text+" 即时客数为"+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 dept_code='"+Trim(suiDBComboBox1->Text)+"' group by dept_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 dept_code='"+Trim(suiDBComboBox1->Text)+"' and store='"+Trim(suiComboBox1->Text)+"' group by store,dept_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::suiButton3Click(TObject *Sender)
{
AnsiString str ;
suiPanel1->Push();
suiButton2->Enabled=true;
str="select store,TIME ,itmaster.dept_code,itmaster.section_code,itmaster.article_code,itmaster.vendor_code,tmpsummday.item_code,itmaster.item_desc , points as quantity, customs,round((netamt/points),2) as price , netamt FROM tmpsummday left join itmaster on tmpsummday.item_code=itmaster.item_code" ;
str=str+" where points<>0 and customs>0 and tmpsummday.item_code<'a' ";
if (suiRadioButton1->Checked){
str=str+" order by points desc";
}else{
str=str+" order by netamt desc";
}
// str=str+" order by netamt";
// tempstr=str+" and customs>0";
try{
dm->dayseq->Active=false;
dm->dayseq->SQL->Clear();
dm->dayseq->SQL->Add(str);
dm->dayseq->Active=true;
}
catch(...){
}
suiEdit1->Text="";
suiStatusBar1->SimpleText="全店铺 ";
}
//---------------------------------------------------------------------------
void __fastcall Tcurren::FormCreate(TObject *Sender)
{
dm->dept->Active=true;
dm->sect->Active=true;
dm->artcode->Active=true;
dm->dayseq->Active=false;
dm->dept->First();
while(!dm->dept->Eof){
suiDBComboBox1->Items->Add(dm->dept->FieldByName("Dept_code")->AsString);
dm->dept->Next();
}
dm->sect->First();
while(!dm->sect->Eof){
suiDBComboBox2->Items->Add(dm->sect->FieldByName("section_code")->AsString);
dm->sect->Next();
}
dm->artcode->First();
while(!dm->artcode->Eof){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -